diff options
Diffstat (limited to 'class.lisp')
| -rw-r--r-- | class.lisp | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -7,22 +7,18 @@ (defclass book () ((haikus - :initform (list "haiku 1" - "haiku 2" - "haiku 3")) + :initform (list "Old brackets~%laying forgotten~%spring anew." + "The water drop~%falling on the cracked ground~%bounces away." + "Striving for more~%time for contentment~%is gone.")) (current :initform 0))) (defmethod display-haiku ((obj book) stream) (with-slots (haikus current) obj - (format *standard-output* "haiku num: ~a" current) - (princ (nth current haikus) stream))) + (format *error-output* "Refreshing display, current is ~a" current) + (format stream (nth current haikus)))) (defmethod next-haiku ((obj book)) (with-slots (haikus current) obj - (format *standard-output* "increasing current") - (let ((factor (if (= current (length haikus)) 0 1))) - (format *standard-output* "increment factor: ~a" factor) - (finish-output *standard-output*) - (setf current - (+ factor - current))))) + (if (= current (- (length haikus) 1)) + (setf current 0) + (incf current)))) |
