Source

clj-estuary / test / estuary / test / promises.clj

Full commit
(ns estuary.test.promises
 ;(:require )
 ;(:use )
 ;(:import )
 )

(def x (promise))
(def y (promise))
(def z (promise))

(def task-z (future (deliver z (+ @x @y))))
(def task-x (future
              (deliver x
                (let[x 23]
                  (doseq [i (range 50000000)] (+ i x)) x))))
(def task-y (future (deliver y 5)))

(def t0 (System/nanoTime))

(send-off (agent nil) (let[zz @z t (* (- (System/nanoTime) t0) 1e-6)] (println zz t "")))
(send (agent nil) #(@task-z))
(send (agent nil) #(@task-x))
(send (agent nil) #(@task-y))