functions of the highest order
There are already a bunch of transducer implementations but they are all implemented with the transformer-protocol which isn't very nice to use. It could be improved by renaming the "@@transducer/step" method to "call" but for now I'm just going to do away with the whole thing.
Its a slightly more abstract reducer function. i.e. it takes an extra parameter. This parameter is the bit of the reducer which combines a new value with the accumulated value. This is what the
map reducer looks like:
const map =
One advantage of transducers is that they know nothing about the type of the value they are accumulating. So they can be easily specialized to create reducers specific to certain data structures.
Another advantage is that transducers enable reduction functions to be composed. And this can reduce the need to allocate intermediary data structures when passing data through a pipeline of operations. Which is a performance win.
npm install transducer
then in your app:
const composefiltermap =
Takes a bunch of transducers and composes them into a new one
const concat = Functioncallconcat "1" // => concat "0" // => 
compose also automatically lifts values out of arrays so you can pass in a mixture of
Functions and get the same result
concat "0" // => 
// =>