• (with-ns ns & body)
Evaluates body in another namespace. ns is either a namespace
object or a symbol. This makes it possible to define functions in
namespaces other than the current one.

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:20 top

(defmacro with-ns
  "Evaluates body in another namespace.  ns is either a namespace
  object or a symbol.  This makes it possible to define functions in
  namespaces other than the current one."
  [ns & body]
  `(binding [*ns* (the-ns ~ns)]
     ~@(map (fn [form] `(eval '~form)) body)))
Vars in clojure.contrib.with-ns/with-ns: defmacro fn map ns *ns* apply binding concat eval list seq the-ns vector
Used in 0 other vars

Comments top

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