Hacker News new | ask | show | jobs
by pcwalton 3833 days ago
> makes it possible to apply such transformations to less collection-like entities such as async channels.

Like https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html (scroll down to the trait implementations)?

2 comments

That's blocking, not async. Of course you could always create a new thread, but you might want to avoid that for performance reasons...
Ok, bad example :-) Rust's mutable-iterator model of abstract collections supports this directly, but Clojure's functional-reduction model does not. I'll see if I can think of a better example, but it might be hard -- mutable iteration is pretty flexible (which is probably why it's what most languages do...).