produces a lazy evaluation
delay, but if the initial forced result is a promise, it will continue to be forced until a non-promise result is capable of being returned.
(define p (lazy (println "hello once") (delay (println "hello twice") "hello"))) (force p) ;; prints "hello once / hello twice" (force p)
The first invocation of
p will print “hello once” followed by “hello twice” to the console, also returning the string “hello”. Subsequent invocations of
p will only return “hello”.