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.
(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))))))
Comments top
No comments for immigrate. Log in to add a comment.