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 /cs | |
| parent | 89bd4de1e2704c1bc562788b2c5e4fc08b71a538 (diff) | |
| download | mal-6301e0b6374cecc5599665be14d6ddc6a31ce1e8.tar.gz mal-6301e0b6374cecc5599665be14d6ddc6a31ce1e8.zip | |
All: TCO let* and quasiquote.
Diffstat (limited to 'cs')
| -rw-r--r-- | cs/step5_tco.cs | 4 | ||||
| -rw-r--r-- | cs/step6_file.cs | 4 | ||||
| -rw-r--r-- | cs/step7_quote.cs | 7 | ||||
| -rw-r--r-- | cs/step8_macros.cs | 7 | ||||
| -rw-r--r-- | cs/stepA_more.cs | 7 |
5 files changed, 21 insertions, 8 deletions
diff --git a/cs/step5_tco.cs b/cs/step5_tco.cs index 95df860..e243153 100644 --- a/cs/step5_tco.cs +++ b/cs/step5_tco.cs @@ -81,7 +81,9 @@ namespace Mal { val = ((MalList)a1)[i+1]; let_env.set(key.getName(), EVAL(val, let_env)); } - return EVAL(a2, let_env); + orig_ast = a2; + env = let_env; + break; case "do": eval_ast(ast.slice(1, ast.size()-1), env); orig_ast = ast[ast.size()-1]; diff --git a/cs/step6_file.cs b/cs/step6_file.cs index db1a7b2..7e3bf7e 100644 --- a/cs/step6_file.cs +++ b/cs/step6_file.cs @@ -82,7 +82,9 @@ namespace Mal { val = ((MalList)a1)[i+1]; let_env.set(key.getName(), EVAL(val, let_env)); } - return EVAL(a2, let_env); + orig_ast = a2; + env = let_env; + break; case "do": eval_ast(ast.slice(1, ast.size()-1), env); orig_ast = ast[ast.size()-1]; diff --git a/cs/step7_quote.cs b/cs/step7_quote.cs index d803ac2..537c20c 100644 --- a/cs/step7_quote.cs +++ b/cs/step7_quote.cs @@ -109,11 +109,14 @@ namespace Mal { val = ((MalList)a1)[i+1]; let_env.set(key.getName(), EVAL(val, let_env)); } - return EVAL(a2, let_env); + orig_ast = a2; + env = let_env; + break; case "quote": return ast[1]; case "quasiquote": - return EVAL(quasiquote(ast[1]), env); + orig_ast = quasiquote(ast[1]); + break; case "do": eval_ast(ast.slice(1, ast.size()-1), env); orig_ast = ast[ast.size()-1]; diff --git a/cs/step8_macros.cs b/cs/step8_macros.cs index af98fe9..b06b1fb 100644 --- a/cs/step8_macros.cs +++ b/cs/step8_macros.cs @@ -136,11 +136,14 @@ namespace Mal { val = ((MalList)a1)[i+1]; let_env.set(key.getName(), EVAL(val, let_env)); } - return EVAL(a2, let_env); + orig_ast = a2; + env = let_env; + break; case "quote": return ast[1]; case "quasiquote": - return EVAL(quasiquote(ast[1]), env); + orig_ast = quasiquote(ast[1]); + break; case "defmacro!": a1 = ast[1]; a2 = ast[2]; diff --git a/cs/stepA_more.cs b/cs/stepA_more.cs index 4fa8387..486c344 100644 --- a/cs/stepA_more.cs +++ b/cs/stepA_more.cs @@ -136,11 +136,14 @@ namespace Mal { val = ((MalList)a1)[i+1]; let_env.set(key.getName(), EVAL(val, let_env)); } - return EVAL(a2, let_env); + orig_ast = a2; + env = let_env; + break; case "quote": return ast[1]; case "quasiquote": - return EVAL(quasiquote(ast[1]), env); + orig_ast = quasiquote(ast[1]); + break; case "defmacro!": a1 = ast[1]; a2 = ast[2]; |
