‹ BackHN Continuity

Thread

Anecdotally, programmers dislike "reduce"

175 points · 283 comments · vinhnx

  1. gorjusborg · · focus · HN ↗
    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.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.