diff options
| author | Joel Martin <github@martintribe.org> | 2014-04-23 21:59:50 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-04-23 21:59:50 -0500 |
| commit | 6301e0b6374cecc5599665be14d6ddc6a31ce1e8 (patch) | |
| tree | dbf1dc2ff6c682fd87c72a7907e7f6e59c8d4c03 /python/step8_macros.py | |
| parent | 89bd4de1e2704c1bc562788b2c5e4fc08b71a538 (diff) | |
| download | mal-6301e0b6374cecc5599665be14d6ddc6a31ce1e8.tar.gz mal-6301e0b6374cecc5599665be14d6ddc6a31ce1e8.zip | |
All: TCO let* and quasiquote.
Diffstat (limited to 'python/step8_macros.py')
| -rw-r--r-- | python/step8_macros.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/python/step8_macros.py b/python/step8_macros.py index 28b68fb..80ca239 100644 --- a/python/step8_macros.py +++ b/python/step8_macros.py @@ -77,11 +77,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 'defmacro!' == a0: func = EVAL(ast[2], env) func._ismacro_ = True |
