store/[org.clojure/clojure "1.8.0"] clj::clojure.core/defonce

Official Documentation

Add notes
Arities
==================================================
   [name expr]

Docstring
==================================================
  defs name to have the root value of the expr iff the named var has no root value,
  else expr is unevaluated

Source

(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))))

Example 1

Edit
(defonce foo 5)
;; => #'user/foo

foo
;; => 5

;; defonce does nothing the second time
(defonce foo 10)
;; => nil

foo
;; => 5

Uses on crossclj