Evaluates body in an anonymous namespace, which is then immediately
removed. The temporary namespace will 'refer' clojure.core.
(defmacro with-temp-ns
"Evaluates body in an anonymous namespace, which is then immediately
removed. The temporary namespace will 'refer' clojure.core."
[& body]
`(try
(create-ns 'sym#)
(let [result# (with-ns 'sym#
(clojure.core/refer-clojure)
~@body)]
result#)
(finally (remove-ns 'sym#))))
Comments top
No comments for with-temp-ns. Log in to add a comment.