ClojureDocs

Nav

Namespaces

namespace

clojure.core

Available since 1.0 (source)
  • (namespace x)
Returns the namespace String of a symbol or keyword, or nil if not present.
2 Examples
user=> (def x "Foobar")
#'user/x

user=> (namespace 'user/x)
"user"
(namespace :admin/live-playlist-details)
;;=> "admin"

(namespace :about)
;;=> nil
See Also

Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be ...

Added by boxie

Returns the name String of a string, symbol or keyword.

Added by abrooks

Creates and interns or locates a global var with the name of symbol and a namespace of the value of ...

Added by delonnewman
1 Note
    By , created 9.5 years ago, updated 9.5 years ago

    Note this does not try to be "smart"

    user=>(namespace 'no-such-name/no-such-var)
    "no-such-name"
    
    user=>(def a-var)
    #'user-a-var
    
    user=>(namespace 'a-var)
    nil