1 types = require "./types.coffee"
3 exports.println = (args...) -> console.log(args.join(" ")) || null
5 exports._pr_str = _pr_str = (obj, print_readably=true) ->
7 switch types._obj_type obj
8 when 'list' then '(' + obj.map((e) -> _pr_str(e,_r)).join(' ') + ')'
9 when 'vector' then '[' + obj.map((e) -> _pr_str(e,_r)).join(' ') + ']'
12 ret.push(_pr_str(k,_r), _pr_str(v,_r)) for k,v of obj
13 '{' + ret.join(' ') + '}'
15 if _r then '"' + (obj.replace(/\\/g, '\\\\')
17 .replace(/\n/g, '\\n')) + '"'
19 when 'keyword' then ":" + obj.slice(1)
20 when 'symbol' then obj.name
22 when 'atom' then "(atom " + _pr_str(obj.val,_r) + ")"