You're viewing version 1.2.0 of intern. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

intern

clojure.core

  • (intern ns name)
  • (intern ns name val)
Finds or creates a var named by the symbol name in the namespace
ns (which can be a symbol or a namespace), setting its root binding
to val if supplied. The namespace must exist. The var will adopt any
metadata from the name symbol. Returns the var.

1 Example top

  • user=> (intern 'user 'x "Foobar")
    #'user/x
    
    user=> x
    "Foobar"
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:5057 top

(defn intern
  "Finds or creates a var named by the symbol name in the namespace
  ns (which can be a symbol or a namespace), setting its root binding
  to val if supplied. The namespace must exist. The var will adopt any
  metadata from the name symbol.  Returns the var."
  {:added "1.0"}
  ([ns ^clojure.lang.Symbol name]
     (let [v (clojure.lang.Var/intern (the-ns ns) name)]
       (when (meta name) (.setMeta v (meta name)))
       v))
  ([ns name val]
     (let [v (clojure.lang.Var/intern (the-ns ns) name val)]
       (when (meta name) (.setMeta v (meta name)))
       v)))
Vars in clojure.core/intern: defn let meta name when

Comments top

No comments for intern. Log in to add a comment.