Function lattices::algebra::monoid

source ยท
pub fn monoid<S: Debug + PartialEq + Clone, const N: usize>(
    items: &[S; N],
    f: &impl Fn(S, S) -> S,
    zero: S,
) -> Result<(), &'static str>
Expand description

Defines a monoid structure.

A monoid is a set of items along with an associative binary operation f and an identity element zero. The f operation combines two items and the zero element acts as the identity for f.