Closed tvarney closed 11 years ago
Looks like let is trying to evaluate its list of substitutions even when they're not function applications.
(let () 4)
works as expected.
(let (x 3) x)
tries to apply 3.
(let ((x ((\ (a) (+ a 3)) 3))) x)
tries to apply 6, so at least function application is working inside the substitution list.
It seems whatever check is happening for basic types in let is failing when it shouldn't.
That's just from playing around a bit with the interpreter, I'll take a closer look at the source later.
I agree, it looks like a problem with let itself; for some reason
(let ((x 4) x)
returns (4), when it should be returning 4.
Fixed; issue was that Let (and letrec) needed to get the car() of the second value in each list since the parser guarantees that all Cons are Nil terminated. Added a bit of logic to check if the cdr() of the list is a cons, then resolve that using car(). The example given by Dr. Canata now works.
Currently, the example given in the project requirements handout states that the code:
should evaluate fine, with a result of 4. However, the interpreter currently does not evaluate this, instead throwing an InterpreterException with the message
We need to get this statement working properly before Thursday.