I tried unsuccessfully to translate it into a loop, and eventually realized that I don't think that can work in a non-lazy context. But I knew exactly what code would work if it could be generated for any number of arguments. Just like the other arities, only bigger.
So, I wrote my first macro (first one without help anyway):
Fixes: #26
The challenge here is that we don't have lazy seqs, so
map
is just an imperative loop:So we needed a way of "tying the knot" to make it work on any number of collections.
Here is how it is done in Clojure:
I tried unsuccessfully to translate it into a
loop
, and eventually realized that I don't think that can work in a non-lazy context. But I knew exactly what code would work if it could be generated for any number of arguments. Just like the other arities, only bigger.So, I wrote my first macro (first one without help anyway):
Then, it gets called by the variable arity of
map
:Example mapping on 5 collections: