The concepts are actually very simple but their effects are complex. This is great introduction though I think a little high level for beginners.
The concepts are actually very simple but their effects are complex. This is great introduction though I think a little high level for beginners.
I can't tell why monoids are supposed to be more directly applicable to programming than any other concept from algebra.
[Edit] On the other hand, it is important to realize that even though these structures look (and indeed are) related, each focuses on a completely different aspect of reality. Monoids are useful in describing composability (where associativity is essential); groups are instrumental in analyzing all kinds of symmetries; vector spaces form a scene on which one deals with linear independence, subspaces, and linear transformations. (All this finds its application in computational algorithms, but it would be interesting to see if the program structure also could be understood using the notion of symmetry and/or linearity.)
> Why not groups?
Because many things you would want to combine don't have inverses. Does the list [1,2,3] have an inverse? No. That's why lists form a monoid and not a group.
> Why not vector spaces?
Because all finite dimensional real vector spaces are isomorphic to R^n so we tend just to use the concrete instances of tuples of floating point numbers.
There is nothing you can comcatenate to a list to get the empty list, nothing you can OR with True to get False, and nothing you can union with a set to get the empty set.
But yes, a good grounding in algebra will help anyway. It’s not an exclusive set ;)
Semirings are interesting for the same reason. "Fun with Semirings"[1] has some great examples, if you're curious.
[1]: https://pdfs.semanticscholar.org/702d/348c32133997e992db362a...