‹ BackHN Continuity

Thread

Anecdotally, programmers dislike "reduce"

175 points · 283 comments · vinhnx

  1. snackbroken · · focus · HN ↗
    Map and Filter are nice because they let you reason locally about a single element in isolation. Reduce(Fold) forces you to reason globally about intermediate results. Reduce also forces you to conjure up a "zero" value of the relevant type, which isn't usually difficult but it does constitute some extra mental overhead.
    1. sigbottle · · focus · HN ↗
      Isn't reduce usually used for monoidal operations? Or do people implicitly absue ordering?

      If the algortihm doesn't work the same forward, backwards, and with a tree scan, it ain't reduce (as a first approximation not IFF)

      1. txhwind · · focus · HN ↗
        If the contraint is not in the signature, and cannot trigger a test failure with typical implementation, it doesn't exist.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.