namespace

functionsince v0.0-927 clojure.core/namespaceEdit
(namespace x)

Details:

Returns the namespace string of a possibly namespace-qualified keyword or symbol.

Returns nil if not present.


Examples:

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

See Also:


Source docstring:
Returns the namespace String of a symbol or keyword, or nil if not present.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn namespace
  [x]
  (if (implements? INamed x)
    (-namespace x)
    (throw (js/Error. (str "Doesn't support namespace: " x)))))