diff options
Diffstat (limited to 'class.lisp')
| -rw-r--r-- | class.lisp | 43 |
1 files changed, 20 insertions, 23 deletions
@@ -1,27 +1,24 @@ (uiop:define-package - :simple-text-clim-frame/class - (:export #:my-class #:my-display) - (:import-from :asdf)) + :solar-short/class + (:export #:book #:display-haiku) + (:import-from :asdf)) -(in-package :simple-text-clim-frame/class) +(in-package :solar-short/class) -(defclass my-class () - ((text-slot - :initform #.(format - nil - "~{~a~^~%~}" - (with-open-file - (in (merge-pathnames - #P"some.text" - (asdf:system-source-directory - "simple-text-clim-frame"))) - (loop for line = (read-line in nil nil) - while line - collect line)))))) +(defclass book () + ((haikus + :initform (list "haiku 1" + "haiku 2" + "haiku 3")) + (current :initform 0))) -(defmethod my-display ((obj my-class) stream) - (with-slots - (text-slot) - obj - (princ text-slot stream))) - +(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)))) |
