Open joinr opened 3 years ago
Interesting. I wonder if it could be generalized to reduce
?
You can, and it's basically what the CollReduce protocol ends up doing (there's an iter-reduce function that reduces over iterators). I haven't thought through any limitations as of yet (I think seqs implement iterable, so it should be general enough while specializing nicely if the collection provides a fast iterator). It's kind of like the bypass for reduce-kv on maps that provides a faster reduction path than using plain reduce.
https://hackernoon.com/faster-clojure-reduce-57a104448ea4
via andre rauh