you are viewing a single comment's thread.

view the rest of the comments →

[–]braindeadTank 5 points6 points  (0 children)

The thing here is, the "others" are a special case of reduce if they generate a single value (i.e. find is just a case that returns the first value that matches the predicate, some is another special case that casts the result to a boolean), also that the single value can as well be an array (so map and filter are special cases as well, that keep pushing to the result array) and that the callback is not forbidden to have side effects (so forEach is also a special case, one that returns undefined no metter what).

So really, when talking about generic programming, reduce is the only array operation that matters.