Changed display of expressions
This commit is contained in:
parent
ee13a75141
commit
4807eb0cbe
|
@ -7,9 +7,16 @@ data Expr = IntE Integer
|
||||||
| LambdaE String Expr
|
| LambdaE String Expr
|
||||||
| QuotedE Expr
|
| QuotedE Expr
|
||||||
| NilE
|
| NilE
|
||||||
deriving (Show)
|
|
||||||
|
|
||||||
-- instance Show Expr where
|
-- Make set! and lambda(?) parsed as cons, detect later set! and lambda as special procedures
|
||||||
-- show (IntE x) = show x
|
|
||||||
-- show (VarE x) = x ++ " ; var"
|
instance Show Expr where
|
||||||
-- show NilE = "nil"
|
show (IntE x) = show x
|
||||||
|
show (VarE x) = x
|
||||||
|
show (SetE _ _) = "#set"
|
||||||
|
show c@(ConsE _ _) = "(" ++ showCons c
|
||||||
|
where showCons (ConsE _ NilE) = ")"
|
||||||
|
showCons (ConsE x xs) = show x ++ " " ++ showCons xs
|
||||||
|
show (LambdaE s e) = "#lambda"
|
||||||
|
show (QuotedE e) = show e
|
||||||
|
show NilE = "nil"
|
||||||
|
|
Loading…
Reference in New Issue