In Clojure (str {:a 1}) returns {:a 1}.
In ClojureScript (str {:a 1}) returns [Object object].
As a result, in order to send data to and from the server I've been
doing this: (goog.json/serialize (cljs-js x)). This seems like
unnecessary overhead to convert everything a JS object first, is there
pr-str will do what you want. That said we should probably add toString
methods to the core datatypes to prevent this surprise.
David
On Fri, Mar 2, 2012 at 11:14 AM, Chris McBride cmm7...@gmail.com wrote:
In Clojure (str {:a 1}) returns {:a 1}.
In ClojureScript (str {:a 1}) returns [Object
Ok Thanks
On Mar 2, 11:19 am, David Nolen dnolen.li...@gmail.com wrote:
pr-str will do what you want. That said we should probably add toString
methods to the core datatypes to prevent this surprise.
David
On Fri, Mar 2, 2012 at 11:14 AM, Chris McBride cmm7...@gmail.com wrote:
In
Related: str is a terrible way to serialize things in JVM-clojure as
well - pr-str is what you want. For example, {:x a} and {:x 'a} both
print the same with str. pr-str also handles lazy sequences, which str
doesn't.
On Mar 2, 8:19 am, David Nolen dnolen.li...@gmail.com wrote:
pr-str will do