During a lein REPL session, I may define a number of functions. However, sometimes I would want the session to 'forget' them - for example when I execute (run-all-tests), this highlights failures from tests that I no longer need. Is there a way to remove functions from the session, or to clean it, without restarting?
You can exit the REPL by typing Ctrl+D (pressing the Ctrl and D keys at the same time).
The clojure. main namespace provides functions that allow Clojure programs and interactive sessions to be launched via Java's application launcher tool java .
use ns-unmap
as described on the Clojure namespaces page http://clojure.org/namespacesuser>
(defn foo [x] (inc x))
#'user/foo
user> (foo 3)
4
user> (ns-unmap *ns* 'foo)
nil
user> (foo 3)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:1:1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With