Created
June 29, 2012 22:04
-
-
Save zcaudate/3020925 to your computer and use it in GitHub Desktop.
clean-ns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn clean-ns [ns] | |
(let [vs (keys (ns-interns ns))] | |
(doseq [v vs] (ns-unmap ns v)) | |
vs)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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