Closures
A closure is a callable procedural object that can use variable bindings in effect when the closure was created.
> (define toggle
(let ((bit 0))
(lambda () (set! bit (- 1 bit)) bit)
) )
> (toggle)
1
> (toggle)
0
Previous slide
Next slide
Back to first slide
View graphic version