delay
produces a delayed evaluation
Usage:
(delay expr*)
Returns a promise that, when forced, evaluates the expressions, returning the final evaluated result. The result is then cached, so further uses of force return the cached value immediately.
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”.