Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pprint the result #5

Open
genmeblog opened this issue May 15, 2020 · 2 comments
Open

pprint the result #5

genmeblog opened this issue May 15, 2020 · 2 comments

Comments

@genmeblog
Copy link

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?

@eraserhd
Copy link
Owner

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.

@genmeblog
Copy link
Author

genmeblog commented May 18, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants