Skip to main content

fold

functionv1.7

clojure.core.reducers/fold

Available in:CLJCLJS
(fold [reducef coll] [combinef reducef coll] [n combinef reducef coll])
Reduces a collection using a (potentially parallel) reduce-combine strategy. The collection is partitioned into groups of approximately n (default 512), each of which is reduced with reducef (with a seed value obtained by calling (combinef) with no arguments). The results of these reductions are then reduced with combinef (default reducef). combinef must be associative, and, when called with no arguments, (combinef) must produce its identity element. These operations may be performed in parallel, but the results will preserve order. Note: Performing operations in parallel is currently not implemented.

No examples yet. Be the first to add one!