Transducers

Prior to taking on transducers, you should first have a strong understanding of both reducers and function composition.

Transduce: Derived from the 17th century scientific latin, “transductionem” means “to change over, convert”. It is further derived from “transducere/traducere”, which means “to lead along or across, transfer”.

A transducer is a composable higher order reducer. It takes a reducer as input, and returns another reducer.

Transducers are:

  • Composable using simple function composition
  • Efficient for large collections with multiple operations: Only enumerates over the collection once, regardless of the number of operations in the pipeline
  • Able to transduce over any enumerable source (e.g., arrays, trees, streams, graphs, ...

Get Composing Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.