3 ms·
It's not that clear there will be one. Transducers have three steps: begin, during and end. In practice, start is only used for reduce operations and outside
by moomin 12y ago
It's not that clear there will be one. Transducers have three steps: begin, during and end. In practice, start is only used for reduce operations and outside of reduce operations end can only be used for its side effects.
There's also definitional issues e.g. can you have an async transducer?
- cfeduke 12y agoYes you can have async and blocking transducers. Forward to the point in the video about channels for a discussion.
- moomin 12y agoBut if you use an async transducer on a channel, it fails. (Actual tested code, sadly.) Which might be okay, but my basic point that it's definitionally fuzzy still holds.
- kbeaty 12y agoYou can indeed use transducers in asynchronous contexts. In fact, that is what intrigues me most about the abstraction. Transducers are defined such that you can abstract the context of input, output and iteration and focus on the transformation of each element from an independent source individually. The implementation of each transducer accepts another transformation in a "pipeline" (eventually the output sink) and accepts an input during an external iteration process. The implementation decides what to do with it (map changes with a function, filter ignores certain values with a predicate, etc.) You can also define transducers that send multiple values for each input (think string.split) or some that do not send any until completion (think buffered results). Since the iteration source and sink are abstracted from the transformation, you can use the same transformation in other contexts (Promises, event streams, IO streams, CSP, etc.) I've been experimenting with transducers in asynchronous contexts in JavaScript if anyone is interested, for example: [1]: http://simplectic.com/projects/underscore-transducer/ http://simplectic.com/projects/underscore-transducer/ [2]: http://simplectic.com/projects/underarm/ http://simplectic.com/projects/underarm/ [3]: https://github.com/transduce/transduce-async https://github.com/transduce/transduce-async [4]: https://github.com/kevinbeaty/transduce-stream https://github.com/kevinbeaty/transduce-stream [5]: https://github.com/transduce/transduce-push https://github.com/transduce/transduce-push [6]: https://github.com/transduce/transduce-then https://github.com/transduce/transduce-then