-
An associative operation to combine values of the implementing type.
This operation must satisfy the semigroup laws:
a.multiply(b).multiply(c) == a.multiply(b.multiply(c))
Declaration
Swift
func multiply(_ other: Self) -> Self
Parameters
other
Value to multipy with the receiver.
Return Value
Multiplication of the receiver value with the parameter value.
-
zero()
Default implementationZero element.
The zero element must obey the semirings laws:
a.multiply(zero()) == zero().multiply(a) == zero()
That is, multiplying any element with
zero
must return thezero
. It is also an alias forempty
ofMonoid
.Default Implementation
Declaration
Swift
static func zero() -> Self
Return Value
A value of the implementing type satisfying the semiring laws.
-
One element.
The one element must obey the semirings laws:
a.multiply(one()) == one().multiply(a) == a
That is, multiplying any element with
one
must return the original element.Declaration
Swift
static func one() -> Self
Return Value
A value of the implementing type satisfying the semiring laws.