aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-07-30 08:58:12 -0500
committerColin Okay <cbeok@protonmail.com>2020-07-30 08:58:12 -0500
commitd163358a91c35a8c77de0ec6f190d40ec9362fd9 (patch)
tree3da651496ce18275ef3a445aab5099ce7d63a769
parent057af65f5e6d6bf6a31ec5484ac23a7ce845157d (diff)
update readme to explain anaphoric macros
-rw-r--r--README.md34
1 files changed, 34 insertions, 0 deletions
diff --git a/README.md b/README.md
index dac90a9..1e2685f 100644
--- a/README.md
+++ b/README.md
@@ -540,6 +540,40 @@ The `pick-out` consumer is interesting enough to see a quick example of:
(#\r #\e #\e #\r #\n)
```
+### Anaphoric Cosumer Macros
+
+If you would like to use `for` and `fold` macros with a little less
+visual noise (but sacrificing some of their flexibility), you can use
+the `gtwiwtg.anaphora` package. Here's an example:
+
+``` lisp
+
+> (use-package :gtwiwtg) ;; gets you the core package
+> (use-package :gtwiwtg.anaphora) ;; gets you the two extra anaphoric consumers
+
+;; ordinary for
+> (for x (times 3) (print x))
+
+0
+1
+2
+
+;; anaphoric for
+> (afor (times 3) (print it)) ;; the variable IT is provided by AFOR
+0
+1
+2
+
+;; ordinary fold
+> (fold (sum 0) (x (times 10)) (+ sum x))
+45
+
+;; anaphoric fold
+> (afold 0 (times 10) (+ acc it)) ;; variables IT and ACC are provided by AFOLD
+45
+```
+
+
### Making New Generators
Generators are subclasses of `gtwiwtg::generator!` that have at least