Lazy evaluation: the delay form plus the Promise class.
Promises are memoized – forced only once.
delayCreate a promise that delays evaluation of an expression until forced.
Promise(Promise promise? x)Test whether a value is a promise.
Parameters:
ANY — Value to testReturns: BOOL — True if x is a promise
(Promise force p)Force a promise, returning its cached value. Non-promises pass through.
Parameters:
ANY — Promise or valueReturns: ANY — The forced value, or p itself if not a promise
Examples:
(Promise force (delay (+ 1 2))) => 3