namespace
List of symbols:
get-in-namespace, get-namespaces, import, ns, with-ns
get-in-namespace
Usage: (get-in-namespace 'SYMBOL)
Return a vector containing all the globals currently defined namespace SYMBOL.
No Examples
get-namespaces
Usage: (get-namespaces)
Return a vector containing all the namespaces currently defined globally.
No Examples
import
Usage: (import namespace [:as symbol])
Will import a namespace. Without an :as then all symbols in the namespace will become available in the current namespace as if local. With [:as symbol] then all namespace symbols become available with symbol:: prepended.
Example:
(ns testing)
(def x #t)
(test::assert-true x)
(ns ::)
(test::assert-true testing::x)
(import testing)
(test::assert-true x)
(import testing :as t)
(test::assert-true t::x)
ns
Usage: (ns SYMBOL)
Changes to namespace. This is "open-ended" change and is intended for use with the REPL prefer with-ns for scripts. The symbol "::" will return to the "root" namespace (i.e. no namespace prepended to globals). This will cause all globals defined to have namespace:: prepended. This will also clear any existing imports.
Example:
(ns testing)
(def x #t)
(test::assert-true x)
(ns ::)
(test::assert-true testing::x)
with-ns
Usage: (with-ns SYMBOL sexp+)
Create a namespace and compile sexp+ within it. Restore the previous namespace when scope ends. THe symbol "::" will return to the "root" namespace (i.e. no namespace prepended to globals). This will cause all globals defined to have namespace:: prepended. This will also clear any existing imports.
Example:
(with-ns test-with-ns
(def ttf (fn () '(1 2 3)))
(test::assert-equal '(1 2 3) (ttf))
(test::assert-equal '(1 2 3) (test-out::ttf)))
(test::assert-equal '(1 2 3) (test-out::ttf))