- Foldable <FA, A>
- Foldable <Env, FA, A>
- TypeClass
- fold <FOLD, F, A, S> (F fa, S state, Func<S, A, S> f)
- foldBack <FOLD, F, A, S> (F fa, S state, Func<S, A, S> f)
- iter <FOLD, F, A> (F fa, Action<A> action)
- toSeq <FOLD, F, A> (F fa)
- collect <FOLD, F, A, B> (F self, Func<A, B> f)
- head <FOLD, F, A> (F fa)
- headOrNone <FOLD, F, A> (F fa)
- headOrInvalid <FOLD, F, FAIL, A> (F fa, FAIL fail)
- headOrLeft <FOLD, F, L, A> (F fa, L left)
- last <FOLD, F, A> (F fa)
- lastOrNone <FOLD, F, A> (F fa)
- isEmpty <FOLD, F, A> (F fa)
- count <FOLD, F, A> (F fa)
- contains <EQ, FOLD, F, A> (F fa, A item)
- sum <NUM, FOLD, F, A> (F fa)
- product <NUM, FOLD, F, A> (F fa)
- forall <FOLD, F, A> (F fa, Func<A,bool> pred)
- exists <FOLD, F, A> (F fa, Func<A, bool> pred)
method S fold <FOLD, F, A, S> (F fa, S state, Func<S, A, S> f) Source #
In the case of lists, 'Fold', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right.
Note that, since the head of the resulting expression is produced by an application of the operator to the first element of the list, 'Fold' can produce a terminating expression from an infinite list.
type | S | Aggregate state type |
param | state | Initial state |
param | f | Folder function, applied for each item in fa |
returns | The aggregate state |
method S foldBack <FOLD, F, A, S> (F fa, S state, Func<S, A, S> f) Source #
In the case of lists, 'FoldBack', when applied to a binary operator, a starting value(typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right.
Note that to produce the outermost application of the operator the entire input list must be traversed.
type | S | Aggregate state type |
param | state | Initial state |
param | f | Folder function, applied for each item in fa |
returns | The aggregate state |
method Unit iter <FOLD, F, A> (F fa, Action<A> action) Source #
Iterate the values in the foldable
type | A | Bound value type |
param | self | Foldable to perform the operation on |
method Seq<A> toSeq <FOLD, F, A> (F fa) Source #
Turn any foldable into a sequence
type | A | Sequence item type |
param | fa | Foldable |
returns | Sequence of As |
method Seq<B> collect <FOLD, F, A, B> (F self, Func<A, B> f) Source #
Convert the foldable to a sequence (IEnumerable) performing a map operation on each item in the structure
type | A | Bound value type |
param | self | Foldable to performt the operation on |
returns | Sequence of As that represent the value(s) in the structure |
method A head <FOLD, F, A> (F fa) Source #
Get the first item in a foldable structure
type | A | Sequence item type |
param | fa | Foldable |
returns | First A produced by the foldable |
method Option<A> headOrNone <FOLD, F, A> (F fa) Source #
Get the first item in a foldable structure
type | A | Sequence item type |
param | fa | Foldable |
returns | First A produced by the foldable (Or None if no items produced) |
method Validation<FAIL, A> headOrInvalid <FOLD, F, FAIL, A> (F fa, FAIL fail) Source #
Get the first item in a foldable structure
type | A | Sequence item type |
param | fa | Foldable |
param | fail | Fail case |
returns | First A produced by the foldable (Or Fail if no items produced) |
method Either<L, A> headOrLeft <FOLD, F, L, A> (F fa, L left) Source #
Get the first item in a foldable structure
type | A | Sequence item type |
param | fa | Foldable |
param | left | Left case |
returns | First A produced by the foldable (Or Left if no items produced) |
method A last <FOLD, F, A> (F fa) Source #
Get the last item in a foldable structure
type | A | Sequence item type |
param | fa | Foldable |
returns | Last A produced by the foldable |
method Option<A> lastOrNone <FOLD, F, A> (F fa) Source #
Get the last item in a foldable structure
type | A | Sequence item type |
param | fa | Foldable |
returns | Last A produced by the foldable (Or None if no items produced) |
method bool isEmpty <FOLD, F, A> (F fa) Source #
Tests whether the foldable structure is empty
type | A | Foldable item type |
param | fa | Foldable |
returns | True if empty, False otherwise |
method int count <FOLD, F, A> (F fa) Source #
Find the length of a foldable structure
type | A | Foldable item type |
param | fa | Foldable |
returns | True if empty, False otherwise |
method bool contains <EQ, FOLD, F, A> (F fa, A item) Source #
Does the element occur in the structure?
type | EQ | Eq type-class |
type | A | Foldable item type |
param | fa | Foldable |
param | item | Item to test |
returns | True if item in the structure |
method A sum <NUM, FOLD, F, A> (F fa) Source #
The 'sum' function computes the sum of the numbers of a structure.
type | A | Foldable item type |
returns | Sum of the numbers in the structure |
method A product <NUM, FOLD, F, A> (F fa) Source #
The 'product' function computes the product of the numbers of a structure.
type | NUM | Foldable && NUM type |
type | A | Foldable item type |
returns | Product of the numbers in the structure |
method bool forall <FOLD, F, A> (F fa, Func<A,bool> pred) Source #
Runs a predicate against the bound value(s). If the predicate holds for all values then true is returned.
NOTE: An empty structure will return true.
param | pred | Predicate to apply |
returns | True if the predicate holds for all values |
method bool exists <FOLD, F, A> (F fa, Func<A, bool> pred) Source #
Runs a predicate against the bound value(s). If the predicate returns true for any item then the operation immediately returns true. False is returned if no items in the structure match the predicate.
NOTE: An empty structure will return false.
param | pred | Predicate to apply |
returns | True if the predicate holds for all values |