5 ms·
> Actually, all most programmers need is either `map` or `reduce`. You actually don't need `map`, you can easily implement that using `reduce` too ;)
by ReleaseCandidat 5y ago
> Actually, all most programmers need is either `map` or `reduce`.
You actually don't need `map`, you can easily implement that using `reduce` too ;)
- yakshaving_jgt 5y agoI'm well aware of that, but I don't think that's a good idea. There is utility in communicating whether you're working with a catamorphism vs a homomorphism. Code is written for humans, after all.
- ReleaseCandidat 5y agoOf course, that wasn't meant seriously. That's why i like `for_each` (or `iter` or whatever it's called) as 'third' function too, because it makes it clear you're doing side-effects.
- feupan 5y agoNobody needs reduce, you’re just making code make less sense. If you’re using reduce when map works you’re just a masochist. https://twitter.com/jaffathecake/status/1213077702300852224 https://twitter.com/jaffathecake/status/1213077702300852224