Closures
A closure is a callable functional object that can use variable bindings in effect when the closure was created.
> (setq toggle
(let ((bit 0))
#'(lambda () (setq bit (- 1 bit)))
) )
#<Interpreted Closure (unnamed) @ #x204c8fca>
> (funcall toggle)
1
> (funcall toggle)
0
Previous slide
Next slide
Back to first slide
View graphic version