(create-var sym {:keys [ns]})
Creates a Var for sym and returns it.
The Var gets interned in the env namespace.
Source
(defn create-var
"Creates a Var for sym and returns it.
The Var gets interned in the env namespace."
[sym {:keys [ns]}]
(let [v (get-in (env/deref-env) [:namespaces ns :mappings (symbol (name sym))])]
(if (and v (or (class? v)
(= ns (ns-name (.ns ^Var v) ))))
v
(let [meta (dissoc (meta sym) :inline :inline-arities :macro)
meta (if-let [arglists (:arglists meta)]
(assoc meta :arglists (qualify-arglists arglists))
meta)]
(intern ns (with-meta sym meta))))))