All Clojure REPL variants (nREPL, REPLy, ..) share some common characteristics, inherited from clojure.main and clojure.repl. One of them, that isn't easy to find out (unless you read e.g. Clojure Programming) is the fact that the last three results of evaluating your code are stored in the vars
*3. The last exception that has occured is stored in
;; Inside lein repl, with the user=> prefix removed and output prefixed with ;; => 1 ;; => 1 2 ;; => 2 3 ;; => 3 4 ;; => 4 (println "results - latest:" *1 "prev:" *2 "oldest:" *3) ;; => results - latest: 4 prev: 3 oldest: 2 ;; => nil
(/ 42 0) ;; => ArithmeticException Divide by zero clojure.lang.Numbers.divide (Numbers.java:156) (println "res" *1 "exception" *e) ;; => res nil exception #<ArithmeticException java.lang.ArithmeticException: Divide by zero> ;; => nil
clojure.repldefines in its namespace some very useful functions and macros such as
dir(prints a sorted list of public vars in a ns; ex.:
(root-cause throwable)- check out their docs at ClojureDocs/clojure.repl.