How to reload a clojure file in REPL

pkaleta picture pkaleta · Oct 5, 2011 · Viewed 66.8k times · Source

What is the preferred way of reloading functions defined in a Clojure file without having to restart the REPL. Right now, in order to use the updated file I have to:

  • edit src/foo/bar.clj
  • close the REPL
  • open the REPL
  • (load-file "src/foo/bar.clj")
  • (use 'foo.bar)

In addition, (use 'foo.bar :reload-all) does not result in required effect, which is evaluating the modified bodies of functions and returning new values, instead of behaving as the source haven't changed at all.

Documentation:

Answer

Ming picture Ming · Dec 2, 2013

Or (use 'your.namespace :reload)