aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-07-10 13:12:47 -0500
committerColin Okay <cbeok@protonmail.com>2020-07-10 13:12:47 -0500
commitd54aa29b7869a4508ead4d608126637348d24872 (patch)
treee5ce483dbb20b46886346d6f57237902301b7596
parent87300fd04068c4144f2b1cc6a26ce34155d60d8c (diff)
typoes
-rw-r--r--README.md28
1 files 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