aboutsummaryrefslogtreecommitdiff
path: root/miniMAL/types.json
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-16 01:15:35 -0600
committerJoel Martin <github@martintribe.org>2015-02-24 09:17:45 -0600
commitad28cf3cb19d91399c52149d798f6c6efb780a51 (patch)
treec92e35586cc92dc146868482701c39393895a649 /miniMAL/types.json
parent320455465294f170f54cda772142f4de4cb6f602 (diff)
downloadmal-ad28cf3cb19d91399c52149d798f6c6efb780a51.tar.gz
mal-ad28cf3cb19d91399c52149d798f6c6efb780a51.zip
miniMAL: add metadata support.
Diffstat (limited to 'miniMAL/types.json')
-rw-r--r--miniMAL/types.json11
1 files changed, 9 insertions, 2 deletions
diff --git a/miniMAL/types.json b/miniMAL/types.json
index 5d1e0d3..26c5ffe 100644
--- a/miniMAL/types.json
+++ b/miniMAL/types.json
@@ -19,13 +19,13 @@
["=", ["get", "a", ["`", "val"]], ["get", "b", ["`", "val"]]],
["=", "a", "b"]]]]],
-["def", "clone", ["fn", ["obj"],
+["def", "_clone", ["fn", ["obj"],
["if", ["list?", "obj"],
["slice", "obj", 0],
["if", ["vector?", "obj"],
["let", ["new-obj", ["slice", "obj", 0]],
["do",
- ["set", "new-obj", "__vector?__", true],
+ ["set", "new-obj", ["`", "__vector?__"], true],
"new-obj"]],
["if", ["map?", "obj"],
["let", ["new-obj", ["hash-map"]],
@@ -38,6 +38,13 @@
"new-obj"]],
["throw", "clone of unsupported type"]]]]]],
+["def", "clone", ["fn", ["obj"],
+ ["let", ["new-obj", ["_clone", "obj"]],
+ ["do",
+ [".", "Object", ["`", "defineProperty"], "new-obj", ["`", "__meta__"],
+ {"enumerable": false, "writable": true}],
+ "new-obj"]]]],
+
["def", "assoc!", ["fn", ["a", "b", "c"], ["do", ["set", "a", "b", "c"], "a"]]],
["def", "assocs!", ["fn", ["hm", "kvs"],
["if", ["empty?", "kvs"],