delay
produces a delayed evaluation
Usage:
(delay expr*) (force value) (force! value) (delay-force expr*)delay returns a promise that evaluates its body the first time it is forced. That result is cached, so later calls return immediately. force resolves one promise layer, or returns non-promises unchanged. force! keeps forcing until the result is no longer a promise. delay-force delays a computation whose result should be forced once before being cached.
An Example
(define p (delay
(println "hello once")
"hello"))
(force p) ;; prints "hello once"
(force p)
The first invocation of p will print “hello once” to the console, and also return the string “hello”. Subsequent invocations of p will only return “hello”.