How to create a REPL for Clojure for which the code is reloadable?
I can create a new project, and get a REPL up and running:
lein new app stack
cd stack
lein repl
(-main)
Doing the above should get you "Hello, World!".
I would like to stay in the REPL, change the code to println
"Howdy partner!", and then just (-main)
again. Either auto-reloading or (perhaps even better) simple manual reloading (for instance with a command like (r)
) would make the environment complete.
It seems with lein I'm already getting into the right namespace (any namespace but the user namespace from which you then have to (in-ns 'some-ns)
is the right namespace!). The only unanswered part is code reloading - either manual or auto.
As it happens I previously asked how to do this with boot.