rep
rep copied to clipboard
pprint the result
Is there the way to get formatted result?
Usually it's done with (set! nrepl.middleware.print/*print-fn* clojure.pprint/pprint)
.
I can prepend every call with this, but it's not too much usable.
$ rep "(set! nrepl.middleware.print/*print-fn* clojure.pprint/pprint)(def a 1)(def b 2)"
#function[clojure.pprint/pprint]
#'user/a
#'user/b
Or different variant - is there a way to get only result of the last call?
First, you can get it to print only the last value by wrapping the expressions in a do
.
You can format the output with the command-line zprint or something similar, if you can isolate the "value" from the "out" and "err" channels. I would rather add any features necessary for isolating those channels rather than add formatting into rep.
Thanks. do
option is not good solution for my use case. I use rep
for dynamic document generation using knitr
R package. However it came up that this is not a problem. The bigger issue is pretty print. I will check zprint
- haven't realized that it had a standalone binary. Will check it if it fits my needs. My current solution is just call pprint
function and removal of value
from printed results.
Take a look how it works (knitr
with rep
): https://github.com/genmeblog/rmarkdown-clojure