cljs.spec.gen.alpha/LazyVar

typepreviously cljs.spec.impl.gen/LazyVarEdit
satisfies IDeref

(LazyVar. f cached)

Source code @ clojurescript:src/main/cljs/cljs/spec/gen/alpha.cljs
(deftype LazyVar [f ^:mutable cached]
  IDeref
  (-deref [this]
    (if-not (nil? cached)
      cached
      (let [x (f)]
        (when-not (nil? x)
          (set! cached x))
        x))))