Beautiful folds in Haskell (2016)
github.com
github.com
You often find people chaining maps and folds and doing all kinds of strange things when a single fold would suffice.
I can live with people not grokking unfold, but the amount of time wasted because people emulate fold using at least 2 passes over a list is probably close to my own petty 30 year lifetime
For example if you did a map of x times 2 then map again with x times 2, I expect a single map of x times 4 without using temporary buffers or multiple passes for the intermediate map (this is a simple example, but gets more complicate once you throw in other stream operators).
I know java didn't do this when I was looking at their collectors source code back then.
[1] https://stackoverflow.com/questions/578063/what-is-haskells-...
Something like it can be defined: https://stackoverflow.com/questions/30210547/grouping-by-obj... although the signature is a bit ugly.