aboutsummaryrefslogtreecommitdiff
path: root/ruby/printer.rb
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-13 14:37:56 -0500
committerJoel Martin <github@martintribe.org>2014-04-13 14:37:56 -0500
commit3a56f91a12ccad642227178c76f8d76cc42f81ee (patch)
tree8ce730b6f4f8cb254dcf8e8f279a57868ae38020 /ruby/printer.rb
parent393c1c447fbc61a6c84b7b003f98f6bd6a4add41 (diff)
downloadmal-3a56f91a12ccad642227178c76f8d76cc42f81ee.tar.gz
mal-3a56f91a12ccad642227178c76f8d76cc42f81ee.zip
Ruby: add stepA_more and rest of core functions.
Diffstat (limited to 'ruby/printer.rb')
-rw-r--r--ruby/printer.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/ruby/printer.rb b/ruby/printer.rb
index 424ca23..cfcd064 100644
--- a/ruby/printer.rb
+++ b/ruby/printer.rb
@@ -7,12 +7,18 @@ def _pr_str(obj, print_readably=true)
"(" + obj.map{|x| _pr_str(x, _r)}.join(" ") + ")"
when Vector
"[" + obj.map{|x| _pr_str(x, _r)}.join(" ") + "]"
+ when Hash
+ ret = []
+ obj.each{|k,v| ret.push(_pr_str(k,_r), _pr_str(v,_r))}
+ "{" + ret.join(" ") + "}"
when String
if _r
obj.inspect # escape special characters
else
obj
end
+ when Atom
+ "(atom " + _pr_str(obj.val, true) + ")"
when nil
"nil"
else