aboutsummaryrefslogtreecommitdiff
path: root/class.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'class.lisp')
-rw-r--r--class.lisp18
1 files changed, 11 insertions, 7 deletions
diff --git a/class.lisp b/class.lisp
index fdc0beb..93fc4d9 100644
--- a/class.lisp
+++ b/class.lisp
@@ -1,6 +1,6 @@
(uiop:define-package
:solar-short/class
- (:export #:book #:display-haiku)
+ (:export #:book #:display-haiku #:next-haiku)
(:import-from :asdf))
(in-package :solar-short/class)
@@ -14,11 +14,15 @@
(defmethod display-haiku ((obj book) stream)
(with-slots (haikus current) obj
+ (format *standard-output* "haiku num: ~a" current)
(princ (nth current haikus) stream)))
-;; (defmethod next-haiku ((book book))
-;; (setf (current book)
-;; (+ (if (= (current book) (length (haikus book)))
-;; 0
-;; 1)
-;; (current book))))
+(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)))))