‹ BackHN Continuity

Thread

Anecdotally, programmers dislike "reduce"

175 points · 283 comments · vinhnx

  1. futune · · focus · HN ↗
    I was going to write a question asking if reduce is the thing I know as accumulate (I think I picked this up from SICP). But then I went to wikipedia, and it seems that an even more common name is fold.

    Here's a hypothesis: The fact that the same operation has half a dozen different names makes it sound like there is a lot to learn. If I am totally familiar with fold, and i come upon a reduce, I may need to think more about what's going on, which is distracting.

    I don't think map and filter have so many synonyms? I know select for filter, but it seems to me less common.

    1. 3836293648 · · focus · HN ↗
      And in some contexts you have the subtle distinction that fold is linear and reduce requires an associative operation and an identity element (aka a monoid)
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.