aboutsummaryrefslogtreecommitdiff
path: root/miniMAL/printer.json
diff options
context:
space:
mode:
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
+]