4 ms·
Strings with string concatenation form a monoid [1] (natural numbers with addition form a commutative monoid, and integers with addition form an abelian group).
by layer8 5y ago
Strings with string concatenation form a monoid [1] (natural numbers with addition form a commutative monoid, and integers with addition form an abelian group). Incidentally, that was literally the topic of the first class in my first CS semester. :)
[1] https://en.m.wikipedia.org/wiki/Monoid https://en.m.wikipedia.org/wiki/Monoid
- dreamcompiler 5y agoOff-topic language quirk: It seems odd to me that monoids can be 'commutative' while groups can be 'abelian' but both adjectives mean the same thing. Alas, if the language were consistent this joke wouldn't exist: Q: What's purple and commutes? A: An abelian grape.