Reputation:
This is the contents of init.clj
(ns init)
(defn get-hotswap []
(filter #(= (ns-name %) 'hotswap) (all-ns)))
(let [x (get-hotswap)]
(let [old-ns *ns*]
(if (empty? x)
(do
(create-ns 'hotswap)
(in-ns 'hotswap)
(def global-kv-store (clojure.core/atom {}))
(in-ns (ns-name old-ns)))
(println "Found Hotswap"))))
Now. hotswap/global-kv-store does not exist, but init/global-kv-store does exist.
How do I fix this? I want to be able to
Thanks!
Upvotes: 1
Views: 355
Reputation: 3919
You can try this:
(if-not (find-ns 'hotswap)
(intern (create-ns 'hotswap) 'global-kv-store (atom {})))
Upvotes: 1