Closure Examples 2
Closures that share variables
> (let ((counter 0))
(defun reset ()
(setf counter 0) counter)
(defun stamp ()
(incf counter) counter))
STAMP
> (list (stamp) (stamp) (reset) (stamp))
(1 2 0 1)
Previous slide
Next slide
Back to first slide
View graphic version