It is confusing to find a "no-gain" example in a page explaining reducers.
Consequently, I'd suggest instead:
;; `vec` is there since seqs don't support parallel folding
(r/foldcat (r/filter even? (r/map inc (vec (range 100000)))))
Perhaps the comment would duplicate some information already in the page (If a collection does not support folding, it will fall back to non-parallel reduce instead.), but newcomers probably will appreciate a reminder (and an example).
The following example included in https://clojure.org/reference/reducers won't run in parallel because
range
is a seq:It is confusing to find a "no-gain" example in a page explaining reducers.
Consequently, I'd suggest instead:
Perhaps the comment would duplicate some information already in the page (
If a collection does not support folding, it will fall back to non-parallel reduce instead.
), but newcomers probably will appreciate a reminder (and an example).