Hacker News new | ask | show | jobs
by tel 4120 days ago
I absolutely promise you that you have used a monoid. Addition is a monoid!

The thing you might not have done is recognized that a subset of the rules of addition end up showing up all over the place and therefore you can translate some of your intuition about addition to these other places.

As a simple example, you might notice that the `length` function converts strings to numbers in such a way that

    length(concat(X, Y)) = length(X) + length(Y)
in other words, length converts the "string monoid" to the "addition monoid" in a very neat way. You can sort of see that it converts "concat" to "+".

This isn't even some kind of mumbo-jumbo "intuition translation". It's a literal dyed in the wool functional translation.

So is there reason to believe that monoids won't be going away anytime soon? I think so—they've already been around and in HEAVY use since the dawn of abstract algebra in the, I dunno, perhaps the 30s?