defs name to have the root value of the expr iff the named var has no root value,
else expr is unevaluated
(defmacro defonce
"defs name to have the root value of the expr iff the named var has no root value,
else expr is unevaluated"
{:added "1.0"}
[name expr]
`(let [v# (def ~name)]
(when-not (.hasRoot v#)
(def ~name ~expr))))
Comments top
No comments for defonce. Log in to add a comment.