4 ms·
I don't have experience with Clojure, but this description makes transducers sound like simple pipeline of functions transforming a stream along the way. This i
by 3cats-in-a-coat 3y ago
I don't have experience with Clojure, but this description makes transducers sound like simple pipeline of functions transforming a stream along the way. This is quite common and readily available in any language, it's also how Unix piping works (for text/binary, but that's a stream of chars/bytes), and I'm wondering why was the name "transducer" required.
- dataangel 3y agoexactly, I see nothing new here
- the-alchemist 3y agoThe ideas are similar, but transducers all greater flexibility and composability and testability. The pure idea of "pipelines" isn't anything new, though, as you pointed out. When you have a Unix pipeline, let's say "cat file | grep -v '^#' | sed 's/\/t//' | wc -l", or something, each step must specify where the input and output comes from. i.e., you can't "pull out" the grep, sed, and wc parts, and then tell it that it's coming from a network socket, or web service instead. It _must_ come from a file descriptor (stdin, stdout). And you can't (easily) multi-thread just the sed piece. Or (easily) add a logger between cat and grep. Or a retry between two parts. Or have it read from a network socket instead. And it's not simple to combine these pipelines with other complex pipelines. Anyway, take that concept, run with it for a while, and you get transducers.