future? is a Clojure predicate for determining whether a value is a future reference. Use it to identify the object returned by future or future-call before inspecting its state with future-done? or retrieving its result with deref. section 14.0 section 14.1
Distinguishing a future from its completion state
Create asynchronous work, then test its identity separately from whether its computation has finished: (def t2 (timer 10)) (future? t2) ;; true (future-done? t2) ;; false Here, future? reports what kind of value t2 is, while future-done? reports the computation's current state. After the work finishes, future-done? becomes true; the value remains a future reference.
(def t2 (timer 10)) ; #1 (future? t2) ; #2 ;; true (future-done? t2) ; #3 ;; false ;; wait 10 seconds. (future-done? t2) ; #4 ;; true
Inspect the complete timed-future example, including creation, type checking, and completion checks. section 14.1
