Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to setup REPL to always pprint?

I found myself wrapping expressions in pprint way too often. Something tells me that there's an option somewhere to do this automatically, but I can't find it. So, instead of typing this:

(pprint list-of-maps)

I would like to just type

list-of-maps

in the REPL and get the pretty printed output.

like image 452
Goran Jovic Avatar asked Aug 15 '13 10:08

Goran Jovic


1 Answers

Just use

(clojure.main/repl :print pprint)

Found here.

From the docs:

repl clojure.main

(repl & options)
...
- :print, function of one argument, prints its argument to the output default: prn
...

like image 56
sloth Avatar answered Oct 25 '22 12:10

sloth