diff options
author | Colin Okay <cbeok@protonmail.com> | 2020-07-10 13:12:47 -0500 |
---|---|---|
committer | Colin Okay <cbeok@protonmail.com> | 2020-07-10 13:12:47 -0500 |
commit | d54aa29b7869a4508ead4d608126637348d24872 (patch) | |
tree | e5ce483dbb20b46886346d6f57237902301b7596 | |
parent | 87300fd04068c4144f2b1cc6a26ce34155d60d8c (diff) |
typoes
-rw-r--r-- | README.md | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -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 |