function | since v0.0-927 | clojure.core/namespace | Edit |
(namespace x)
Returns the namespace string of a possibly namespace-qualified keyword or symbol.
Returns nil
if not present.
With namespaces:
(namespace :foo/bar)
;;=> "foo"
(namespace 'foo/bar)
;;=> "foo"
Without namespaces:
(namespace :foo)
;;=> nil
(namespace 'foo)
;;=> nil
Strings have no concept of a namespace:
(name "foo/bar")
;;=> nil
Returns the namespace String of a symbol or keyword, or nil if not present.
(defn namespace
[x]
(if (implements? INamed x)
(-namespace x)
(throw (js/Error. (str "Doesn't support namespace: " x)))))