Transducers
summary
Claims that Clojure’s transducers make map/filter/mapcat into context-free transformations that compose left-to-right, avoid creating no intermediate collections, and run efficiently. Tools shown: transducer-returning map/filter/mapcat plus reuse sites like into/sequence/transduce/chan and channels/observables integration. Demonstrations include composing baggage-processing steps, early termination via reduced, completion/init semantics, and a working Clojure implementation that reuses the same transformation code across collections, lazy sequences, channels, and event streams.
AI-written summary · about
chapters (25)
- 0:00What are They?
- 1:31What kinds of Processes?
- 3:56Transducers in the Real World
- 4:59Conveyances, sources, sinks are irrelevant
- 5:56Transformation in the Programming World
- 6:55Conveyances are everywhere
- 8:03No reuse
- 9:57Creating Transducers (def process-bags (comp (mapcatting unbundle-pallet) (filtering non-food?) (mapping label-heavy)))
- 11:25Using Transducers
- 14:44Transducible Processes
- 16:04Deriving Transducers
- 16:38Many list fns can be defined in terms of foldr • encapsulates the recursion • easier to reason about and transform
- 18:46Similarly, via reduce (foldl) • returning eager, appendy vectors
- 21:42Transducers • modify a process by transforming its reducing function
- 23:42reduce-based map et al redux (defn nopl f coll)
- 25:30Backwards comp?
- 27:15Transducers are Fast
- 27:57Transducer Types, Thus Far
- 30:14Early Termination • Reduction normally processes all input . Sometimes a process has just had enough input, or gotten external trigger to terminate
- 32:25Transducers Support reduced
- 36:37A Stateful Transducer
- 37:01Completion
- 40:46Init
- 43:10Filter, returning a Transducer
- 43:53The Goal








