-
Notifications
You must be signed in to change notification settings - Fork 4
promise
Turtle Kitty edited this page Jan 28, 2016
·
1 revision
This macro allows lazy evaluation of expressions. It returns a promise, which must later be forced by calling the value method. This can be called multiple times; the expression executes but once.
(def count 0)
(def p
(promise
(seq
(set! count count.inc)
(* 3 4))))
p.value
-> 12
count
-> 1
p.value
-> 12
p.value
-> 12
count
-> 1