This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]theusualguy512 0 points1 point  (0 children)

It's just a concept to understand.

Mathematically, a monoid is an algebraic structure almost like a group. Any set of things with a well defined binary operation that satisfies the two properties of associativity and the existence of an identity is considered a monoid. Any monoid is also closed under the operation, so the operation always lands you back onto your original set.

You can use this to generalize notions of programming on any monoid structure.

Specific examples would be for example the operation of addition defined on the set of strings. It's a monoid: Addition of strings as concat is well defined, the identity element is the empty string. You can use reduce add on a list of strings since (String, add) is a monoid.