Skip to content

Instantly share code, notes, and snippets.

@zcaudate
Created June 29, 2012 22:04
Show Gist options
  • Save zcaudate/3020925 to your computer and use it in GitHub Desktop.
Save zcaudate/3020925 to your computer and use it in GitHub Desktop.
clean-ns
(defn clean-ns [ns]
(let [vs (keys (ns-interns ns))]
(doseq [v vs] (ns-unmap ns v))
vs))
;; In REPL
(ns testing)
(use '[<util>.core :as <util>]) ;;load in clean-ns
(ns-interns *ns*)
; => {}
(defn a [] 9)
(ns-interns *ns*)
; => {a #'testing/a} - We have put 'a' in the interns
(<util>/clean-ns *ns*)
;=> (a)
(ns-interns *ns*)
; => {} - 'a' is now gone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment