1.2.0 permalink Arrow_down_16x16
  • (immigrate & ns-names)
Create a public var in this namespace for each public var in the
namespaces named by ns-names. The created vars have the same name, root
binding, and metadata as the original except that their :ns metadata
value is this namespace.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/ns_utils.clj:88 top

(defn immigrate
  "Create a public var in this namespace for each public var in the
  namespaces named by ns-names. The created vars have the same name, root
  binding, and metadata as the original except that their :ns metadata
  value is this namespace."
  [& ns-names]
  (doseq [ns ns-names]
    (require ns)
    (doseq [[sym var] (ns-publics ns)]
      (let [sym (with-meta sym (assoc (meta var) :ns *ns*))]
        (if (.hasRoot var)
          (intern *ns* sym (.getRoot var))
          (intern *ns* sym))))))
Vars in clojure.contrib.ns-utils/immigrate: *ns* defn doseq intern let ns require
Used in 0 other vars

Comments top

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