There are some special variables available only in the REPL, to ease interaction with previous evaluations:
- *1 and *2 refer to the last and before-last evaluation result of the REPL.
- *e refers to the last exception thrown (you can use clojure.stacktrace functions to inspect this)
Examples:
user> 123
123
user> (pprint *1)
123
nil
user> (pprint *1)
nil
nil
user> (throw (java.lang.Exception. "My exception"))
; Evaluation aborted.
user> (clojure.stacktrace/print-stack-trace *e)
java.lang.RuntimeException:
java.lang.Exception:
My exception
at
clojure.lang.Util.runtimeException (Util.java:165)
clojure.lang.Compiler.eval (Compiler.java:6476)
clojure.lang.Compiler.eval (Compiler.java:6431)
Nincsenek megjegyzések:
Megjegyzés küldése