aboutsummaryrefslogtreecommitdiff
path: root/python/step5_tco.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/step5_tco.py')
-rw-r--r--python/step5_tco.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/step5_tco.py b/python/step5_tco.py
index 72457e9..cbb92c9 100644
--- a/python/step5_tco.py
+++ b/python/step5_tco.py
@@ -45,7 +45,9 @@ 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 "do" == a0:
eval_ast(ast[1:-1], env)
ast = ast[-1]