4

If I want to demonstrate something, is it possible that I can run a command on cider and it prints after each line the result of evaluating that line ?

(def xx {:a "a" :b "b"})
(:a xx)
(:c xx [])

And, after running (something similar to):

(def xx {:a "a" :b "b"}) ; => #'ns-name.playground/xx
(:a xx) ; => "a"
(:c xx "nothing") ; => "nothing"

1 Answer 1

7

Yes. C-u C-x C-e eval-last-sexp-and-insert , evaluates the last sexp and inserts it at point. or: in the cider-eval menu : eval-last-sexp-and-pretty-print-comment insert the output as a comment in the following line like so:

(def xx {:a "a" :b "b"}) 
;; => #'ns-name.playground/xx
(:a xx)  
;; => "a"
(:c xx "nothing") 
;; => "nothing"
2
  • cider-pprint-eval-last-sexp-to-comment nowadays Commented Jan 17, 2020 at 22:28
  • Its cider-pprint-eval-last-sexp-to-comment or C-c C-v C-f C-c C-e. Commented Nov 15, 2020 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.