Merge pull request #104 from dubek/hashmap-equality-test
[jackhill/mal.git] / julia / printer.jl
index e3c2ae8..44e0b1e 100644 (file)
@@ -12,9 +12,9 @@ function pr_str(obj, print_readably=true)
         "[$(join([pr_str(o, _r) for o=obj], " "))]"
     elseif isa(obj, Dict)
         "{$(join(["$(pr_str(o[1],_r)) $(pr_str(o[2],_r))" for o=obj], " "))}"
-    elseif isa(obj, String)
+    elseif isa(obj, AbstractString)
         if length(obj) > 0 && obj[1] == '\u029e'
-            ":$(obj[2:end])"
+            ":$(obj[3:end])"
         elseif _r
             str = replace(replace(replace(obj,
                                           "\\", "\\\\"),
@@ -28,6 +28,10 @@ function pr_str(obj, print_readably=true)
         "nil"
     elseif typeof(obj) == types.MalFunc
         "(fn* $(pr_str(obj.params,true)) $(pr_str(obj.ast,true)))"
+    elseif typeof(obj) == types.Atom
+        "(atom $(pr_str(obj.val,true)))"
+    elseif typeof(obj) == Function
+        "#<native function: $(string(obj))>"
     else
         string(obj)
     end