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"

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"
  • cider-pprint-eval-last-sexp-to-comment nowadays – Erwin Rooijakkers Jan 17 '20 at 22:28
  • Its cider-pprint-eval-last-sexp-to-comment or C-c C-v C-f C-c C-e. – Pranav Bhaskar Nov 15 '20 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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