Rust's iterators optimize nicely—and contain a footgun

from blog ntietz.com blog - technically a blog, | ↗ original
↗ original
I saw a claim recently that in functional programming using "map/filter iterates over the list twice, while the foreach loop iterates only once." The author continued that "Haskell can fuse maps together as an optimization but I don't think you safely fuse arbitrary map/filters? I dunno." There are really two claims here: in functional...