我很惊讶,dev/user.clj 中的这段代码在启动时不会运行
(ns user) ; user ns is loaded by REPL startup
(println "Evaluating dev/user.clj")
(when-not (resolve 'xxx)
(def xxx 1)
(println "defing xxx"))
这对我有用
(defonce yyy (let [tmp 1] (println (str "deffing yyy as " tmp))
tmp))
在 clojurians 社群中也有类似的方法建议给我
[https://clojurians.slack.com/archives/C053AK3F9/p1683882344251029][Slack]
(ns user)
(when-not (resolve 'xxx)
(intern 'user 'xxx 42)
(prn "!!!"))