
Hi John
Your evalStep case for binary operations (Add Mult, etc) are only
going down the 'left-spine' when they don't match a Val
eg:
evalStep d(Add x y)
= case x of
(Val a) -> case y of
(Val b) -> Val (a+b)
left -> Add x (evalStep d y)
right -> Add (evalStep d x)y
The code wants to be something like this...
evalStep d(Add x y)
= case x of
(Val a) -> case y of
(Val b) -> Val (a+b)
left -> Add x (evalStep d y)
right -> Add (evalStep d x) (evalStep d y)
^^^^^^^^^
Best wishes
Stephen
On 1 March 2010 22:17, John Moore
Hi, Can anyone explain what I'm doing wrong in the subtitution of the Let statement. If you look at test three. It wont substitute the second var "x". I enclose the file because this program is getting too big to copy and paste.
John _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners