type | since v0.0-927 | clojure.lang/Delay | Edit |
(Delay. f value)
(deftype Delay [^:mutable f ^:mutable value]
IDeref
(-deref [_]
(when f
(set! value (f))
(set! f nil))
value)
IPending
(-realized? [x]
(not f))
IPrintWithWriter
(-pr-writer [x writer opts]
(-write writer "#object[cljs.core.Delay ")
(pr-writer {:status (if (nil? f) :ready :pending), :val value} writer opts)
(-write writer "]")))