blob: fdc0beb915974bb0a7d1a46372d990d5493c7736 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
(uiop:define-package
:solar-short/class
(:export #:book #:display-haiku)
(:import-from :asdf))
(in-package :solar-short/class)
(defclass book ()
((haikus
:initform (list "haiku 1"
"haiku 2"
"haiku 3"))
(current :initform 0)))
(defmethod display-haiku ((obj book) stream)
(with-slots (haikus current) obj
(princ (nth current haikus) stream)))
;; (defmethod next-haiku ((book book))
;; (setf (current book)
;; (+ (if (= (current book) (length (haikus book)))
;; 0
;; 1)
;; (current book))))
|