I like printf debugging, is there a function in clojure that works like php's var_dump that prints anything it gets?
I'm trying to parse html with jsoup and I'd like to see what I'm doing by printing it as a ring response, in the REPL I see the response as the html file I tried to load, in the browser I see nothing and the terminal show an error: java.lang.Exception: Unrecognized body.
To print to a string, use pr-str
. Or use println
to print to the REPL.
(pr-str {:a 1}) ;=> "{:a 1}"
(println {:a 1}) ;=> nil
***REPL contains output***
If you want more options and pretty printing, you could try clojure.pprint or fipp
(require '[clojure.pprint :refer [pprint]])
(pprint {:a 1}); => nil
***You can't see it but REPL now contains beautifully formatted output***