From d54aa29b7869a4508ead4d608126637348d24872 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 10 Jul 2020 13:12:47 -0500 Subject: typoes --- README.md | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3cf379a..647eb71 100644 --- a/README.md +++ b/README.md @@ -525,17 +525,29 @@ A silly example: ``` lisp -(defclass countdown (gtwiwtg::generator!) - ((value :reader countdown-value - :initarg :value - :initform 0))) +> (defclass countdown (gtwiwtg::generator!) + ((value :accessor countdown-value + :initarg :value + :initform 0))) -(defmethod gtwiwtg::next ((g cowntdown)) - (decf (countdown-value g))) +> (defmethod gtwiwtg::next ((g countdown)) + (decf (countdown-value g))) -(defmethod gtwiwtg::has-next-p ((g countdown)) - (plusp (countdown-value g))) +> (defmethod gtwiwtg::has-next-p ((g countdown)) + (plusp (countdown-value g))) +;; you might also want a constructor + +> (defun countdown (n) (make-instance 'countdown :value n)) + +;; now you can use it: + +> (for x (countdown 4) (print x)) + +3 +2 +1 +0 ``` You can see that `next` ASSUMES that there is a next value. This is -- cgit v1.2.3