News for hackers. Stuff that matters.
Re:FP techniques that will help you write better JavaScript by ReleaseCandidat on Friday February 11, 2022 @04:39AM (#30299307)
> Actually, all most programmers need is either `map` or `reduce`.

You actually don't need `map`, you can easily implement that using `reduce` too ;)

Re:FP techniques that will help you write better JavaScript by feupan on Friday February 11, 2022 @08:54AM (#30301484)
Nobody 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

Re:FP techniques that will help you write better JavaScript by yakshaving_jgt on Friday February 11, 2022 @04:47AM (#30299381)
I'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.

Re:FP techniques that will help you write better JavaScript by ReleaseCandidat on Friday February 11, 2022 @04:58AM (#30299438)
Of 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.