Using datatypes
- val wuss =Cons(Integer(3),Cons(Symbol(“hi”),Nil));
Cons(Integer 3,Cons(Symbol “hi”,Nil)) : Sexpr; (* ‘(3 hi) *)
- fun car Nil = Nil | car (Cons(x,_) = x;
val car = fn : Sexpr -> Sexpr;
- fun cdr Nil = Nil | cdr (Cons(_,xs) = xs;
val car = fn : Sexpr -> Sexpr;
Cons(Symbol “hi”,Nil) : Sexpr;