From 3fb3743ff483cd1e4612d87557eecc62817b10b2 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Wed, 25 Feb 2015 23:01:16 -0600 Subject: miniMAL: add classOf and fix printing. --- miniMAL/printer.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'miniMAL/printer.json') diff --git a/miniMAL/printer.json b/miniMAL/printer.json index 2a6a51d..7463c78 100644 --- a/miniMAL/printer.json +++ b/miniMAL/printer.json @@ -23,7 +23,7 @@ ["keys", "exp"]], ["`", "join"], ["`", " "]], ["`", "}"]], - ["if", ["=", ["`", "string"], ["type", "exp"]], + ["if", ["=", ["`", "[object String]"], ["classOf", "exp"]], ["if", ["=", ["`", "\u029e"], ["get", "exp", 0]], ["str", ["`", ":"], ["slice", "exp", 1]], ["if", "print_readably", @@ -36,7 +36,7 @@ ["`", "replace"], ["RegExp", ["`", "\n"], ["`", "g"]], ["`", "\\n"]], ["`", "\""]], "exp"]], - ["if", ["=", ["`", "number"], ["type", "exp"]], + ["if", ["=", ["`", "[object Number]"], ["classOf", "exp"]], "exp", ["if", ["=", null, "exp"], ["`", "nil"], @@ -52,9 +52,11 @@ ["`", " "], ["pr-str", ["get", "exp", ["`", "ast"]]], ["`", ")"]], + ["if", ["=", ["`", "[object Function]"], ["classOf", "exp"]], + ["str", ["`", "#"]], ["if", ["atom?", "exp"], ["str", ["`", "(atom "], ["get", "exp", ["`", "val"]], ["`", ")"]], - ["str", ["`", "#"]]]]]]]]]]]]]]], + ["str", ["`", "#"]]]]]]]]]]]]]]]], ["def", "pr-list", ["fn", ["lst", "print_readably", "sep"], [".", ["map", ["fn", ["s"], ["pr-str", "s", "print_readably"]], "lst"], -- cgit v1.2.3