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

Official Documentation

Add notes
Arities
==================================================
   [promise val]

Docstring
==================================================
  Delivers the supplied value to the promise, releasing any pending
  derefs. A subsequent call to deliver on a promise will have no effect.

Source

(defn deliver
  "Delivers the supplied value to the promise, releasing any pending
  derefs. A subsequent call to deliver on a promise will have no effect."
  {:added "1.1"
   :static true}
  [promise val] (promise val))

Example 1

Edit
(def x (promise))
;; => #'user/x
;; Trying to deref at this point will make your repl wait forever


(deliver x 100)
;; => #<core$promise$reify__5534@4369a50b: 100>

;; the promise has been delivered, deref x will return immediately
@x
;; => 100

Example 2

Edit
;; Create a promise
(def p (promise))
;; => #'user/p ; p is our promise

;; Check if was delivered/realized
(realized? p)
;; => false ; No yet

;; Delivering the promise
(deliver p 42)
;; => #<core$promise$reify__5727@47122d: 42>

;; Check again if it was delivered
(realized? p)
;; => true ; Yes!

;; Deref to see what has been delivered
@p
;; => 42

;; Note that @ is shorthand for deref
(deref p)
;; => 42

Uses on crossclj