
Fun with Macros: Gathering - stevelosh
http://stevelosh.com/blog/2018/05/fun-with-macros-gathering/
======
omaranto
As a very minor point I think I like the names Mathematica uses a little
better: instead of "gathering" and "gather", they are called "reap" and "sow",
respectively.

------
lispm
'gathering' is also explained in CLtL2:
[https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node365.html](https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node365.html)

------
birthdaywizard
Very neat. It reminds me of the writer monad.

------
norswap
Nice, but how does it beat passing a writable collection around?

~~~
reikonomusha
This is basically what it is, except the collection is made otherwise
inaccessible through the closure. The closure exposes the minimum interface
needed to adjoin elements to the collection, whereas passing the collection
around allows all sorts of modification. I’d also say that if this was used a
lot, the intent is more clearly specified and it’s easier to narrow down where
a bug might be (precisely because rampant changes to the collection are not
possible in the body of the macro).

