logoalt Hacker News

sigbottletoday at 7:08 PM1 replyview on 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)


Replies

snackbrokentoday at 8:31 PM

That's what I'm used to as well, but in my experience a lot of programmers take fold and reduce to be synonyms. A monoidal reduce is much less "scary" than a general fold. I suspect most programmers have never[1] heard the word monoid, let alone know what it means, and having to remember the meaning of a weird new word is enough to make most people dislike something compared to the simpler more familiar operations.

[1]Or if they have, their only encounter with it is the "a monad is just a monoid in the category of endofunctors" meme.

show 1 reply