From d163358a91c35a8c77de0ec6f190d40ec9362fd9 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Thu, 30 Jul 2020 08:58:12 -0500 Subject: update readme to explain anaphoric macros --- README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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 -- cgit v1.2.3