diff options
| author | Joel Martin <github@martintribe.org> | 2015-02-16 01:15:35 -0600 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2015-02-24 09:17:45 -0600 |
| commit | ad28cf3cb19d91399c52149d798f6c6efb780a51 (patch) | |
| tree | c92e35586cc92dc146868482701c39393895a649 /miniMAL/types.json | |
| parent | 320455465294f170f54cda772142f4de4cb6f602 (diff) | |
| download | mal-ad28cf3cb19d91399c52149d798f6c6efb780a51.tar.gz mal-ad28cf3cb19d91399c52149d798f6c6efb780a51.zip | |
miniMAL: add metadata support.
Diffstat (limited to 'miniMAL/types.json')
| -rw-r--r-- | miniMAL/types.json | 11 |
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"], |
