2017-03-08 11:14:44 -05:00
|
|
|
;; This is based on an example presented in "Let Over Lambda" by Doug Hoyte.
|
|
|
|
|
2017-03-06 16:52:06 -05:00
|
|
|
(let ((direction 'up))
|
|
|
|
(defun toggle-counter-direction ()
|
|
|
|
(setq direction
|
|
|
|
(if (eq direction 'up)
|
|
|
|
'down
|
|
|
|
'up)))
|
|
|
|
|
|
|
|
(defun counter-class ()
|
|
|
|
(let ((counter 0))
|
|
|
|
(lambda ()
|
|
|
|
(if (eq direction 'up)
|
|
|
|
(setq counter (+ counter 1))
|
|
|
|
(setq counter (- counter 1)))))))
|