5 ms·
OP here. My original submitted title was: It never makes sense to use foldl on lists (in Haskell); first line of the linked content. But someone dropped the bra
by tirumaraiselvan 7y ago
OP here. My original submitted title was: It never makes sense to use foldl on lists (in Haskell); first line of the linked content. But someone dropped the bracketed content.
- candeira 7y agoThe bracketed "in Haskell" really tied the title together.
- dnautics 7y agoIt's also true in other languages. Erlang's foldr specifically annotates this in the documentation.
- Dylan16807 7y agoThe advantages to foldr in certain situations are very cross-language. But foldl vs. foldl' is more about a badly-optimized implementation detail than anything else. It's very fair to qualify it as "in Haskell".
- masklinn 7y agoErlang's foldr says exactly the opposite though, because Erlang is an eager language: > foldl/3 is tail recursive and is usually preferred to foldr/3.
- dnautics 7y agooh jeez I totally missed that. Thanks!