News for hackers. Stuff that matters.
Re:Go is still not good by tuetuopay on Friday August 22, 2025 @11:29AM (#44985804)
Depending on your iterator implementation (or, lackthere of), the functional boils down to your first example.

For example, Rust iterators are lazily evaluated with early-exits (when filtering data), thus it's your first form but as optimized as possible. OTOH python's map/filter/etc may very well return a full list each time, like with your intermediate.

I would say that any sane language allowing functional-style data manipulation will have them as fast as manual for-loops. (that's why Rust bugs you with .iter()/.collect())

Re:Go is still not good by maleldil on Friday August 22, 2025 @11:49AM (#44986036)
Python map/filter/zip/etc. return generators, so they're lazily evaluated.
Re:Go is still not good by tuetuopay on Friday August 22, 2025 @01:15PM (#44987089)
Thanks, I was not sure, hence the "may". Comment edited :)
Re:Go is still not good by Capricorn2481 on Friday August 22, 2025 @11:34AM (#44985862)
Clojure transducers as well.