There's the lazy library, but it's not functional, i.e. I define a to be 1, define b as a + a, force b, it gives 2, but then I force set a to be 5, and it gives b as 2 again.
>>1,3
After being forced the first time, the promise will cache its result. Further forceing will return that result.
> racket
Welcome to Racket v5.1.> (define a 2)> (define b (delay (+ a 2)))> (set! a 3)> (force b)
5> (set! a 4)> (force b)
5
> racket -il lazy
Welcome to Racket v5.1.> (define a 2)> (define b (+ a 2))> (force (set! a 3))> (force b)
5> (force (set! a 4))> (force b)
5
> scheme
MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.
Copyright (C) 2010 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Image saved on Tuesday March 9, 2010 at 6:41:34 PM
Release 9.0.1 || Microcode 15.1 || Runtime 15.7 || SF 4.41 || LIAR/i386 4.118 || Edwin 3.116
1 ]=> (define a 2)
;Value: a
1 ]=> (define b (delay (+ a 2)))
;Value: b
1 ]=> (set! a 3)
;Value: 2
1 ]=> (force b)
;Value: 5
1 ]=> (set! a 4)
;Value: 3
1 ]=> (force b)
;Value: 5