Skip to content

clojure.core/*ns*

View this page on ClojureDocs

Type: var Added: Clojure 1.0 Examples: 3 Runnable: 0
()

A clojure.lang.Namespace object representing the current namespace.

Examples

by boxie on . May have evaluation errors.
by rafmagana on . May have evaluation errors.
by Artiavis on . May have evaluation errors.

Note by gstamp

A trap I fell into was that ns seems to get assigned to clojure.core when run as a "gen-class" compiled class.

Note by Artiavis

To clarify the above point, see my example above. Although within Lein/Boot/REPL/Compiler contexts, *ns* is thread-local due to the use of the binding machinery, and so in-ns works in those situtations, *ns* has a root of clojure.core. That means that, at runtime, you cannot call in-ns within functions until you've first called binding. (This could be relevant for e.g. eval calls.)


Content from the matching ClojureDocs page, with authors credited on each contribution.