http://mathworld.wolfram.com/Monoid.html
Most of his examples have an identity, giving a monoid.
* (string, concat): identity ''
* numbers with addition/multiplication: identity 0/1
* numbers with min/max: Numbers in computers are
finite, so this is quite useful. stdint.h defines
INT32_MAX, INT32_MIN, etc.
* booleans with && / || : true / false
* function composition: identity function f(x) = x
* frequency map: {} or {A: 0, B:0, ...} depending on
how you define it
Comparators: Is this a bug in the post? It doesn't seem to follow the pattern because the arity of the functions is different. In a semigroup or monoid all the elements are supposed to be drawn from the same set.Other examples I can think of:
* Python's dict with respect to member .update()
(if you think of it as an operator rather than
mutating member). Identity is {}
* Unix Pipes: identity 'cat' (note that the shell
supports point-free programming)