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/step9_try.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'miniMAL/step9_try.json') 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], -- cgit v1.2.3