From 320455465294f170f54cda772142f4de4cb6f602 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Mon, 16 Feb 2015 00:33:30 -0600 Subject: miniMAL: keyword, vector and hash-map support. --- miniMAL/step3_env.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'miniMAL/step3_env.json') diff --git a/miniMAL/step3_env.json b/miniMAL/step3_env.json index 353c3dd..e72de07 100644 --- a/miniMAL/step3_env.json +++ b/miniMAL/step3_env.json @@ -14,7 +14,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], -- cgit v1.2.3