Semigroup
public protocol Semigroup
A semigroup is an algebraic structure that consists of a set of values and an associative operation.
-
An associative operation to combine values of the implementing type.
This operation must satisfy the semigroup laws:
a.combine(b).combine(c) == a.combine(b.combine(c))Declaration
Swift
func combine(_ other: Self) -> SelfParameters
otherValue to combine with the receiver.
Return Value
Combination of the receiver value with the parameter value.
-
combine(_:_:)Extension methodCombines two values of the implementing type.
Declaration
Swift
static func combine(_ a: Self, _ b: Self) -> SelfParameters
aValue of the implementing type.
bValue of the implementing type.
Return Value
Combination of
aandb. -
combineAll(_:_:)Extension methodCombines a variable number of values (at least one) of the implementing type, in the order provided in the call.
Declaration
Swift
static func combineAll(_ first: Self, _ elems: Self...) -> SelfParameters
firstFirst value of the implementing type.
elemsValues of the implementing type.
Return Value
A single value of the implementing type representing the combination of all the parameter values.
-
combineAll(_:_:)Extension methodCombines an array of values of the implementing type, in the order provided in the call.
Declaration
Swift
static func combineAll(_ first: Self, _ elems: [Self]) -> SelfParameters
firstFirst value of the implementing type.
elemsValues of the implementing type.
Return Value
A single value of the implementing type representing the combination of all the parameter values.
Install in Dash
Semigroup Protocol Reference