Monoids have an identity value—i.e., a value that when applied to other values via the monoid does not change the value
+ is a monoid in Clojure; +’s identity is 0
A monoid’s function (operation) must be associative and communicative
Monoid’s are useful for parallel processing because of their associative and communicative properties—i.e., we can slice a list into smaller parts and recursively (and in parallel) apply a monoid operation to recombine each single result
Monoid’s do not need to have an inverse (unlike groups in Group Theory)
Monoids must return take values of the same type and return a value of the same type
Monoids have three components:
Field of values of same type
Operation
Identity value
Trivial examples:
Integers, addition, 0
Integers, multiplication, 1
Strings, concat, “”
Generality: less general than semigroup, more general than group
Practically, in Clojure, monoids will have a 0-arity and dyadic functions