diff options
| author | Joel Martin <github@martintribe.org> | 2015-02-16 00:33:30 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-02-16 00:33:30 -0600 |
| commit | 320455465294f170f54cda772142f4de4cb6f602 (patch) | |
| tree | 43c99b1539f192954f1f7ff18fed2b132c191431 /miniMAL/step9_try.json | |
| parent | d90c784472f6131f28612eb6eaa02404e002178d (diff) | |
| download | mal-320455465294f170f54cda772142f4de4cb6f602.tar.gz mal-320455465294f170f54cda772142f4de4cb6f602.zip | |
miniMAL: keyword, vector and hash-map support.
Diffstat (limited to 'miniMAL/step9_try.json')
| -rw-r--r-- | miniMAL/step9_try.json | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/miniMAL/step9_try.json b/miniMAL/step9_try.json index a00604a..585a1b0 100644 --- a/miniMAL/step9_try.json +++ b/miniMAL/step9_try.json @@ -10,7 +10,7 @@ ["def", "READ", ["fn", ["strng"], ["read-str", "strng"]]], ["def", "pair?", ["fn", ["x"], - ["if", ["list?", "x"], + ["if", ["sequential?", "x"], ["if", [">", ["count", "x"], 0], true, false], false]]], @@ -48,7 +48,17 @@ ["env-get", "env", "ast"], ["if", ["list?", "ast"], ["map", ["fn", ["x"], ["EVAL", "x", "env"]], "ast"], - "ast"]]]], + ["if", ["vector?", "ast"], + ["vectorl", ["map", ["fn", ["x"], ["EVAL", "x", "env"]], "ast"]], + ["if", ["map?", "ast"], + ["let", ["new-hm", ["hash-map"]], + ["do", + ["map", ["fn", ["k"], ["set", "new-hm", + ["EVAL", "k", "env"], + ["EVAL", ["get", "ast", "k"], "env"]]], + ["keys", "ast"]], + "new-hm"]], + "ast"]]]]]], ["def", "LET", ["fn", ["env", "args"], ["if", [">", ["count", "args"], 0], |
