• (with-temp-ns & body)
Evaluates body in an anonymous namespace, which is then immediately
removed. The temporary namespace will 'refer' clojure.core.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/with_ns.clj:28 top

(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#))))
Vars in clojure.contrib.with-ns/with-temp-ns: defmacro apply concat create-ns let list refer-clojure remove-ns seq vector
Used in 0 other vars

Comments top

No comments for with-temp-ns. Log in to add a comment.