Comment

Comment by gorjusborg

I would guess that a dislike for reduce overlaps with a preference with imperative languages.

Filter and map are easy because you can make more assertions about them without inspection:

- they take a list-like as input

- they take a function as input

- they return a list-like as output

As opposed to reduce:

- it takes a list-like as input

- it takes a function as input

The output type is not fixed, and its behavior is not fixed. If you pass the right function, reduce is filter, or map, or something else we've never seen.

parent gorjusborg 1 month ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton