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***