From 6301e0b6374cecc5599665be14d6ddc6a31ce1e8 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 23 Apr 2014 21:59:50 -0500 Subject: All: TCO let* and quasiquote. --- python/step7_quote.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python/step7_quote.py') diff --git a/python/step7_quote.py b/python/step7_quote.py index 1002613..de19c6d 100644 --- a/python/step7_quote.py +++ b/python/step7_quote.py @@ -63,11 +63,14 @@ def EVAL(ast, env): let_env = Env(env) for i in range(0, len(a1), 2): let_env.set(a1[i], EVAL(a1[i+1], let_env)) - return EVAL(a2, let_env) + ast = a2 + env = let_env + # Continue loop (TCO) elif "quote" == a0: return ast[1] elif "quasiquote" == a0: - return EVAL(quasiquote(ast[1]), env) + ast = quasiquote(ast[1]); + # Continue loop (TCO) elif "do" == a0: eval_ast(ast[1:-1], env) ast = ast[-1] -- cgit v1.2.3