4 ms·
A monoid is when you have some data and an operation that's sort of like addition. Addition on numbers is sort of like addition, so that counts. Addition on vec
by c3534l 7y ago
A monoid is when you have some data and an operation that's sort of like addition. Addition on numbers is sort of like addition, so that counts. Addition on vectors counts. Multipication is a bit like addition, and multiplying numbers counts as a monoid. String concatenation is sort of like addition and it counts. Logical OR is kind of like addition for logic where 1 + 0 = 1, 0 + 1 = 1, 0 + 0 = 0, 1 + 1 = 1 where 0 is False, 1 is True, and + is OR.
Monoids are very abstract which means they only have the vaguest kind of sort of like addition on them. Groups are less abstract, semigroups more abstract.
To be sort of like addition up to the level of monoids, you having to:
1. have something that's a bit like 0
2. adding in a random parenthesis doesn't matter
3. it needs to be an operation on two elements, like two strings, two logical values, or two numbers
That's it really. Sometimes you have to squint at an operation to see how it's like addition. Which is to say it's not really about addition at all. It's just an operation. It's about the specific three rules.
- RangerScience 7y agoOkay, neat, thank you! Addition is sort of like addition, as is multiplication, and subtraction. Is division sort of like addition? And, functions seem like they're not sort of like addition - `sin(cos(x)) ?= cos(sin(x))`, or `log(cos(x)) ?= cos(log(x))` (I honestly don't remember that trig)