-
Eagerly reduces a structure of values from left to right, also performing a transformation of values.
Declaration
Swift
static func reduceLeftTo<A, B>( _ fa: Kind<Self, A>, _ f: (A) -> B, _ g: (B, A) -> B) -> BParameters
faStructure of values.
fTransforming function.
gFolding function.
Return Value
Summary value of this reduction.
-
Lazily reduces a structure of values from right to left, also performing a transformation of values.
Declaration
Parameters
faStructure of values.
fTransforming function.
gFolding function.
Return Value
Potentially lazy summary value of this reduction.
-
reduceLeft(_:_:)Extension methodEagerly reduces a structure of values from left to right without transforming them.
Declaration
Swift
static func reduceLeft<A>( _ fa: Kind<Self, A>, _ f: (A, A) -> A) -> AParameters
faStructure of values.
fFolding function.
Return Value
Summary value of this reduction.
-
reduceRight(_:_:)Extension methodLazily reduces a structure of values from right to left without transforming them.
Declaration
Parameters
faStructure of values.
fFolding function.
Return Value
Potentially lazy summary value of this reduction.
-
reduceLeftToOption(_:_:_:)Extension methodReduces the elements of a structure down to a single value by applying the provided transformation and aggregation funtions in a left-associative manner.
Declaration
Parameters
faValue to be folded.
fTransforming function.
gFolding function.
Return Value
Optional summary value resulting from the folding process. It will be an
Option.noneif the structure is empty, or a value if not. -
reduceRightToOption(_:_:_:)Extension methodReduces the elements of a structure down to a single value by applying the provided transformation and aggregation functions in a right-associative manner.
Declaration
Parameters
faValue to be folded.
fTransforming function.
gFolding function.
Return Value
Optional summary value resulting from the folding process. It will be an
Option.noneif the structure is empty, or a value if not. -
isEmpty(_:)Extension methodChecks if a structure of values is empty.
An instance of
Reducibleis never empty.Declaration
Swift
static func isEmpty<A>(_ fa: Kind<Self, A>) -> BoolParameters
faStructure of values.
Return Value
falseif the structure contains any value,trueotherwise. -
nonEmpty(_:)Extension methodChecks if a structure of values is not empty.
An instance of
Reducibleis always non-empty.Declaration
Swift
static func nonEmpty<A>(_ fa: Kind<Self, A>) -> BoolParameters
faStructure of values.
Return Value
trueif the structure contains any value,falseotherwise. -
reduce(_:)Extension methodReduces a structure of values to a summary value using the combination capabilities of the
Semigroupinstance of the underlying type.Parameters
faStructure of values.
Return Value
Summary value of this reduction.
-
reduceMap(_:_:)Extension methodReduces a structure of values by mapping them to a type with a
Semigroupinstance, and using its combination capabilities.Parameters
faStructure of values.
fMapping function.
Return Value
Summary value of this reduction.
Install in Dash
Reducible Protocol Reference