On Sat, Feb 4, 2012 at 2:14 PM, Thomas Heller <th.hel...@gmail.com> wrote:
> Hey, > > I'm playing with ClojureScript and one thing that would help me out in > a big way would be to print out data at certain points. > > I can call (.log js/console "test" 1 2 3 4) and it prints the expected > results, but whenever I want to log a Clojure Object I just get its > classname and can inspect how its represented in JS, interesting but > not what I need. > > Is there any function I can call which outputs the data as it would > look in the code? > > (.log js/console [1 2 3 4]) should log [1 2 3 4] but currently logs > cljs.core.Vector (Chrome btw.) > (.log js/console {:hello "world"}) logs cljs.core.ObjMap, etc > > Basically whatever the REPL would print, I'd like to see. > > (print [:a 1 "2"]) just complains with "No *print-fn* fn set for > evaluation environment". > > Any hints? > > Thanks, > /thomas pr-str is probably what you want (.log js/console (pr-str [1 2 3 4])) David -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en