‹ BackHN Continuity

Thread

Anecdotally, programmers dislike "reduce"

175 points · 283 comments · vinhnx

  1. remywang · · focus · HN ↗
    I’m so confused, how are you supposed to perform aggregation without reduce? This is like saying “I like plus and times, but I don’t like divide because it’s hard.” I mean sure, but you need it??
    1. jay_kyburz · · focus · HN ↗
      Yeah, but you never _need_ reduce. You can just have a boring loop.

      I like boring code.

      1. lkuty · · focus · HN ↗
        Not in Elixir. Unless you use tail recursion to simulate the loop. I love reduce and the other functions of the Enum module, so I have 165 calls to reduce in my code base (plus 338 map and 116 filter). It's the swiss army knife of functional programming and I don't see any problem with its usage.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.