25 lines
893 B
Plaintext
25 lines
893 B
Plaintext
---
|
|
Test
|
|
---
|
|
| script | lisp interpreter fixture |
|
|
| # | Object with multiple methods |
|
|
| show | evaluate |!-
|
|
|
|
(defun counter-class-multi ()
|
|
(let ((counter 0))
|
|
(lambda (msg)
|
|
(case msg
|
|
((:inc)
|
|
(setq counter (+ counter 1)))
|
|
((:dec)
|
|
(setq counter (- counter 1)))))))
|
|
|
|
-!|
|
|
| show | evaluate | (setq my-counter (counter-class-multi)) |
|
|
| check | evaluate | (funcall my-counter :inc) | 1 |
|
|
| check | evaluate | (funcall my-counter :inc) | 2 |
|
|
| check | evaluate | (funcall my-counter :inc) | 3 |
|
|
| check | evaluate | (funcall my-counter :dec) | 2 |
|
|
| check | evaluate | (funcall my-counter :dec) | 1 |
|
|
| check | evaluate | (funcall my-counter :dec) | 0 |
|