Reducers
summary
Claim: make Clojure programs get faster on multi‑core machines by turning map/filter/mapcat into reduction transformers that implement a reducible protocol so collections drive reduction. Implementation uses reducers (reducer wrappers), reduce for single‑thread semantics, and fold (reduce + combine) to allow safe parallelism with a tunable partition size (default ~512). Map/filter/mapcat become collection‑ignorant, compose as reducer recipes, and demos show significant speedups versus lazy seqs while remaining compatible with sequential reduce.
AI-written summary · about
chapters (9)
- 0:00Reducers introduction
- 3:20Functional programming history
- 8:41Reduce to reducers
- 13:58Mapping and filtering
- 20:15Collection-independent transforms
- 25:53Fold for parallelism
- 33:40Parallel foldable reducers
- 36:50Reducers performance demo
- 39:20Q&A on distribution
related talks
45mTransducers
06mHow to Write a Fast, Reducible Collection
38mLost in Transduction
01h 03mUnleash Your Data with Clojure: Using Transducers and Sequences
01h 00m“Transducers: from Clojure to C++"
40mAn Introduction to Combinator Compilers and Graph Reduction Machines
01h 01mTransforming Data using the Functional API
31mClojure Parallelism Beyond Futures
