diff --git a/Interpreter.cs b/Interpreter.cs index 0c82e0a..af71bbc 100644 --- a/Interpreter.cs +++ b/Interpreter.cs @@ -490,7 +490,9 @@ public class Interpreter : AST.IExprVisitor switch (binding) { case VarBinding(var pattern, var valueExpr): - var value = evaluate(env, valueExpr); + // By passing newEnv, we let the var definition refer to + // earlier bindings in the list. + var value = evaluate(newEnv, valueExpr); try { pattern.accept((value, newEnv), new PatternBinder());