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

ns-resolve

clojure.core

  • (ns-resolve ns sym)
Returns the var or Class to which a symbol will be resolved in the
namespace, else nil. Note that if the symbol is fully qualified,
the var/Class to which it resolves need not be present in the
namespace.

2 Examples top

  • user=> (defn f [n] (* n n n))
    #'user/f
    user=> ((ns-resolve *ns* (symbol "f")) 10)
    1000
  • ;; See also http://clojure.org/namespaces for information on namespaces in Clojure and how to inspect and manipulate them
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:3373 top

(defn ns-resolve
  "Returns the var or Class to which a symbol will be resolved in the
  namespace, else nil.  Note that if the symbol is fully qualified,
  the var/Class to which it resolves need not be present in the
  namespace."
  {:added "1.0"}
  [ns sym]
  (clojure.lang.Compiler/maybeResolveIn (the-ns ns) sym))
Vars in clojure.core/ns-resolve: defn ns the-ns

Comments top

No comments for ns-resolve. Log in to add a comment.