aboutsummaryrefslogtreecommitdiff
path: root/miniMAL/printer.json
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2015-02-11 21:56:47 -0600
committerJoel Martin <github@martintribe.org>2015-02-11 21:56:47 -0600
commitc1fe72ae2b94d37cbf027aa185c27307d9776c56 (patch)
tree6826d1941743bf7d450b538bbcae86fb6749b8e9 /miniMAL/printer.json
parentff26ebdb816da07b28b29073868994fc7eabf8d1 (diff)
downloadmal-c1fe72ae2b94d37cbf027aa185c27307d9776c56.tar.gz
mal-c1fe72ae2b94d37cbf027aa185c27307d9776c56.zip
miniMAL: step1.
Diffstat (limited to 'miniMAL/printer.json')
-rw-r--r--miniMAL/printer.json25
1 files changed, 25 insertions, 0 deletions
diff --git a/miniMAL/printer.json b/miniMAL/printer.json
new file mode 100644
index 0000000..28d5d4d
--- /dev/null
+++ b/miniMAL/printer.json
@@ -0,0 +1,25 @@
+["do",
+
+["def", "pr-str", ["fn", ["exp", "print_readably"],
+ ["if", ["list?", "exp"],
+ ["str",
+ ["`", "("],
+ [".", ["map", ["fn", ["x"], ["pr-str", "x", "print_readably"]], "exp"],
+ ["`", "join"], ["`", " "]],
+ ["`", ")"]],
+ ["if", ["=", ["`", "string"], ["type", "exp"]],
+ ["str", ["`", "\""], "exp", ["`", "\""]],
+ ["if", ["=", ["`", "number"], ["type", "exp"]],
+ "exp",
+ ["if", ["=", null, "exp"],
+ ["`", "nil"],
+ ["if", ["=", true, "exp"],
+ ["`", "true"],
+ ["if", ["=", false, "exp"],
+ ["`", "false"],
+ ["if", ["=", ["`", "Symbol"], ["get", "exp", ["`", "type"]]],
+ ["get", "exp", ["`", "val"]],
+ ["str", ["`", "#<unknown: "], "exp", ["`", ">"]]]]]]]]]]],
+
+null
+]