LanguageExt.Core

LanguageExt.Core Traits Foldable

Contents

class FoldableExtensions Source #

Methods

method S FoldMaybe <T, A, S> ( this K<T, A> ta, S initialState, Func<S, Func<A, Option<S>>> f) Source #

where T : Foldable<T>

Fold until the Option returns None

Parameters

type A

Value type

type S

State type

param f

Fold function

param initialState

Initial state for the fold

param ta

Foldable structure

returns

Aggregated value

method S FoldMaybe <T, A, S> ( this K<T, A> ta, S initialState, Func<S, A, Option<S>> f) Source #

where T : Foldable<T>

Fold until the Option returns None

Parameters

type A

Value type

type S

State type

param f

Fold function

param initialState

Initial state for the fold

param ta

Foldable structure

returns

Aggregated value

method S FoldBackMaybe <T, A, S> ( this K<T, A> ta, S initialState, Func<A, Func<S, Option<S>>> f) Source #

where T : Foldable<T>

Fold until the Option returns None

Parameters

type A

Value type

type S

State type

param f

Fold function

param initialState

Initial state for the fold

param ta

Foldable structure

returns

Aggregated value

method S FoldBackMaybe <T, A, S> ( this K<T, A> ta, S initialState, Func<S, A, Option<S>> f) Source #

where T : Foldable<T>

Fold until the Option returns None

Parameters

type A

Value type

type S

State type

param f

Fold function

param initialState

Initial state for the fold

param ta

Foldable structure

returns

Aggregated value

method S FoldWhile <T, A, S> ( this K<T, A> ta, S initialState, Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldWhile <T, A, S> ( this K<T, A> ta, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackWhile <T, A, S> ( this K<T, A> ta, S initialState, Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackWhile <T, A, S> ( this K<T, A> ta, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldWhileM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldWhileM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, A, K<M, S>> f, Func<A, bool> predicate) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldBackWhileM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldBackWhileM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, A, K<M, S>> f, Func<A, bool> predicate) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldUntil <T, A, S> ( this K<T, A> ta, S initialState, Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldUntil <T, A, S> ( this K<T, A> ta, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldUntilM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate) Source #

where M : Monad<M>
where T : Foldable<T>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldUntilM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, A, K<M, S>> f, Func<A, bool> predicate) Source #

where M : Monad<M>
where T : Foldable<T>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackUntil <T, A, S> ( this K<T, A> ta, S initialState, Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackUntil <T, A, S> ( this K<T, A> ta, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldBackUntilM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldBackUntilM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, A, K<M, S>> f, Func<A, bool> predicate) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S Fold <T, A, S> ( this K<T, A> ta, S initialState, Func<A, Func<S, S>> f) Source #

where T : Foldable<T>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S Fold <T, A, S> (this K<T, A> ta, S initialState, Func<S, A, S> f) Source #

where T : Foldable<T>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method K<M, S> FoldM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<A, Func<S, K<M, S>>> f) Source #

where T : Foldable<T>
where M : Monad<M>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method K<M, S> FoldM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, A, K<M, S>> f) Source #

where T : Foldable<T>
where M : Monad<M>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S FoldBack <T, A, S> (this K<T, A> ta, S initialState, Func<S, Func<A, S>> f) Source #

where T : Foldable<T>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method S FoldBack <T, A, S> (this K<T, A> ta, S initialState, Func<S, A, S> f) Source #

where T : Foldable<T>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method K<M, S> FoldBackM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, Func<A, K<M, S>>> f) Source #

where T : Foldable<T>
where M : Monad<M>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method K<M, S> FoldBackM <T, A, M, S> ( this K<T, A> ta, S initialState, Func<S, A, K<M, S>> f) Source #

where T : Foldable<T>
where M : Monad<M>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method A Fold <T, A> (this K<T, A> tm) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A FoldWhile <T, A> (this K<T, A> tm, Func<(A State, A Value), bool> predicate) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A FoldUntil <T, A> (this K<T, A> tm, Func<(A State, A Value), bool> predicate) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method B FoldMap <T, A, B> (this K<T, A> ta, Func<A, B> f) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapWhile <T, A, B> (this K<T, A> ta, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapUntil <T, A, B> (this K<T, A> ta, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapBack <T, A, B> (this K<T, A> ta, Func<A, B> f) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B FoldMapBackWhile <T, A, B> (this K<T, A> ta, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B FoldMapBackUntil <T, A, B> (this K<T, A> ta, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method Seq<A> ToSeq <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method Lst<A> ToLst <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method Arr<A> ToArr <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method Iterable<A> ToIterable <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method bool IsEmpty <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method int Count <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

Returns the size/length of a finite structure as an int. The default implementation just counts elements starting with the leftmost.

Instances for structures that can compute the element count faster than via element-by-element counting, should provide a specialised implementation.

method bool Exists <T, A> (this K<T, A> ta, Func<A, bool> predicate) Source #

where T : Foldable<T>

Does an element that fits the predicate occur in the structure?

method bool ForAll <T, A> (this K<T, A> ta, Func<A, bool> predicate) Source #

where T : Foldable<T>

Does the predicate hold for all elements in the structure?

method bool Contains <EqA, T, A> (this K<T, A> ta, A value) Source #

where EqA : Eq<A>
where T : Foldable<T>

Does the element exist in the structure?

method bool Contains <T, A> (this K<T, A> ta, A value) Source #

where T : Foldable<T>

Does the element exist in the structure?

method Option<A> Find <T, A> (this K<T, A> ta, Func<A, bool> predicate) Source #

where T : Foldable<T>

Find the first element that match the predicate

method Option<A> FindBack <T, A> (this K<T, A> ta, Func<A, bool> predicate) Source #

where T : Foldable<T>

Find the last element that match the predicate

method Seq<A> FindAll <T, A> (this K<T, A> ta, Func<A, bool> predicate) Source #

where T : Foldable<T>

Find the elements that match the predicate

method Seq<A> FindAllBack <T, A> (this K<T, A> ta, Func<A, bool> predicate) Source #

where T : Foldable<T>

Find the elements that match the predicate

method A Sum <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where A : IAdditionOperators<A, A, A>, IAdditiveIdentity<A, A>

Computes the sum of the numbers of a structure.

method A Product <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where A : IMultiplyOperators<A, A, A>, IMultiplicativeIdentity<A, A>

Computes the product of the numbers of a structure.

method Option<A> Head <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

Get the head item in the foldable or None

method Option<A> Last <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>

Get the head item in the foldable or None

method K<F, Unit> Iter <T, A, F, B> (this K<T, A> ta, Func<A, K<F, B>> f) Source #

where T : Foldable<T>
where F : Applicative<F>

Map each element of a structure to an 'Applicative' action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit Iter <T, A> (this K<T, A> ta, Action<A> f) Source #

where T : Foldable<T>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit Iter <T, A> (this K<T, A> ta, Action<int, A> f) Source #

where T : Foldable<T>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Option<A> Min <OrdA, T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the minimum value in the structure

method Option<A> Min <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the minimum value in the structure

method Option<A> Max <OrdA, T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the maximum value in the structure

method Option<A> Max <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the maximum value in the structure

method A Min <OrdA, T, A> (this K<T, A> ta, A initialMin) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the minimum value in the structure

method A Min <T, A> (this K<T, A> ta, A initialMin) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the minimum value in the structure

method A Max <OrdA, T, A> (this K<T, A> ta, A initialMax) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the maximum value in the structure

method A Max <T, A> (this K<T, A> ta, A initialMax) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the maximum value in the structure

method A Average <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where A : INumber<A>

Find the average of all the values in the structure

method B Average <T, A, B> (this K<T, A> ta, Func<A, B> f) Source #

where T : Foldable<T>
where B : INumber<B>

Find the average of all the values in the structure

method Option<A> At <T, A> (this K<T, A> ta, Index index) Source #

where T : Foldable<T>

Find the element at the specified index or None if out of range

method (Seq<A> True, Seq<A> False) Partition <T, A> (this K<T, A> ta, Func<A, bool> f) Source #

where T : Foldable<T>

Partition a foldable into two sequences based on a predicate

Parameters

type A

Bound value type

param f

Predicate function

param ta

Foldable structure

returns

Partitioned structure

class FoldableExtensions Source #

Methods

method S FoldWhileT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldWhileT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackWhileT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackWhileT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldUntilT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldUntilT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackUntilT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackUntilT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, A, S> f, Func<(S State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<A, Func<S, S>> f) Source #

where T : Foldable<T>
where U : Foldable<U>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S FoldT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, A, S> f) Source #

where T : Foldable<T>
where U : Foldable<U>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S FoldBackT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, Func<A, S>> f) Source #

where T : Foldable<T>
where U : Foldable<U>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method S FoldBackT <T, U, A, S> ( this K<T, K<U, A>> tua, S initialState, Func<S, A, S> f) Source #

where T : Foldable<T>
where U : Foldable<U>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method A FoldT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A FoldWhileT <T, U, A> (this K<T, K<U, A>> tua, Func<(A State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A FoldUntilT <T, U, A> (this K<T, K<U, A>> tua, Func<(A State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method B FoldMapT <T, U, A, B> (this K<T, K<U, A>> tua, Func<A, B> f) Source #

where T : Foldable<T>
where U : Foldable<U>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapWhileT <T, U, A, B> (this K<T, K<U, A>> tua, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapUntilT <T, U, A, B> (this K<T, K<U, A>> tua, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapBackT <T, U, A, B> (this K<T, K<U, A>> tua, Func<A, B> f) Source #

where T : Foldable<T>
where U : Foldable<U>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B FoldMapBackWhileT <T, U, A, B> (this K<T, K<U, A>> tua, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B FoldMapBackUntilT <T, U, A, B> (this K<T, K<U, A>> tua, Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method Seq<A> ToSeqT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

List of elements of a structure, from left to right

method Lst<A> ToLstT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

List of elements of a structure, from left to right

method Arr<A> ToArrT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

List of elements of a structure, from left to right

method Iterable<A> ToEnumerableT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

List of elements of a structure, from left to right

method bool IsEmptyT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

List of elements of a structure, from left to right

method int CountT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

Returns the size/length of a finite structure as an int. The default implementation just counts elements starting with the leftmost.

Instances for structures that can compute the element count faster than via element-by-element counting, should provide a specialised implementation.

method bool ExistsT <T, U, A> (this K<T, K<U, A>> tua, Func<A, bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Does an element that fits the predicate occur in the structure?

method bool ForAllT <T, U, A> (this K<T, K<U, A>> tua, Func<A, bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Does the predicate hold for all elements in the structure?

method bool ContainsT <EqA, T, U, A> (this K<T, K<U, A>> tua, A value) Source #

where EqA : Eq<A>
where T : Foldable<T>
where U : Foldable<U>

Does the element exist in the structure?

method bool ContainsT <T, U, A> (this K<T, K<U, A>> tua, A value) Source #

where T : Foldable<T>
where U : Foldable<U>

Does the element exist in the structure?

method Option<A> FindT <T, U, A> (this K<T, K<U, A>> tua, Func<A, bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Find the first element that match the predicate

method Option<A> FindBackT <T, U, A> (this K<T, K<U, A>> tua, Func<A, bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Find the last element that match the predicate

method Seq<A> FindAllT <T, U, A> (this K<T, K<U, A>> tua, Func<A, bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Find the the elements that match the predicate

method Seq<A> FindAllBackT <T, U, A> (this K<T, K<U, A>> tua, Func<A, bool> predicate) Source #

where T : Foldable<T>
where U : Foldable<U>

Find the the elements that match the predicate

method A SumT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : IAdditionOperators<A, A, A>, IAdditiveIdentity<A, A>

Computes the sum of the numbers of a structure.

method A ProductT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : IMultiplyOperators<A, A, A>, IMultiplicativeIdentity<A, A>

Computes the product of the numbers of a structure.

method Option<A> HeadT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

Get the head item in the foldable or None

method Option<A> LastT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>

Get the head item in the foldable or None

method K<F, Unit> IterT <T, U, A, F, B> (this K<T, K<U, A>> tua, Func<A, K<F, B>> f) Source #

where T : Foldable<T>
where U : Foldable<U>
where F : Applicative<F>

Map each element of a structure to an 'Applicative' action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit IterT <T, U, A> (this K<T, K<U, A>> tua, Action<int, A> f) Source #

where T : Foldable<T>
where U : Foldable<U>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit IterT <T, U, A> (this K<T, K<U, A>> tua, Action<A> f) Source #

where T : Foldable<T>
where U : Foldable<U>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Option<A> MinT <OrdA, T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>
where OrdA : Ord<A>

Find the minimum value in the structure

method Option<A> MinT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : IComparable<A>

Find the minimum value in the structure

method Option<A> MaxT <OrdA, T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>
where OrdA : Ord<A>

Find the maximum value in the structure

method Option<A> MaxT <T, U, A> (this K<T, K<U, A>> tua) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : IComparable<A>

Find the maximum value in the structure

method A MinT <OrdA, T, U, A> (this K<T, K<U, A>> tua, A initialMin) Source #

where T : Foldable<T>
where U : Foldable<U>
where OrdA : Ord<A>

Find the minimum value in the structure

method A MinT <T, U, A> (this K<T, K<U, A>> tua, A initialMin) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : IComparable<A>

Find the minimum value in the structure

method A MaxT <OrdA, T, U, A> (this K<T, K<U, A>> tua, A initialMax) Source #

where T : Foldable<T>
where U : Foldable<U>
where OrdA : Ord<A>

Find the maximum value in the structure

method A MaxT <T, U, A> (this K<T, K<U, A>> tua, A initialMax) Source #

where T : Foldable<T>
where U : Foldable<U>
where A : IComparable<A>

Find the maximum value in the structure

method A AverageT <T, A> (this K<T, A> ta) Source #

where T : Foldable<T>
where A : INumber<A>

Find the average of all the values in the structure

method B AverageT <T, A, B> (this K<T, A> ta, Func<A, B> f) Source #

where T : Foldable<T>
where B : INumber<B>

Find the average of all the values in the structure

method Option<A> AtT <T, A> (this K<T, A> ta, Index index) Source #

where T : Foldable<T>

Find the element at the specified index or None if out of range

class Foldable Source #

Methods

method S foldWhile <T, A, S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldWhile <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackWhile <T, A, S> ( Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackWhile <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldWhileM <T, A, M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldWhileM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackWhileM <T, A, M, S> ( Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackWhileM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldUntil <T, A, S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldUntil <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldUntilM <T, A, M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>
where T : Foldable<T>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldUntilM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>
where T : Foldable<T>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackUntil <T, A, S> ( Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackUntil <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackUntilM <T, A, M, S> ( Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackUntilM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S fold <T, A, S> (Func<A, Func<S, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S fold <T, A, S> (Func<S, A, S> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method K<M, S> foldM <T, A, M, S> ( Func<A, Func<S, K<M, S>>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method K<M, S> foldM <T, A, M, S> ( Func<S, A, K<M, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S foldBack <T, A, S> (Func<S, Func<A, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method S foldBack <T, A, S> (Func<S, A, S> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method K<M, S> foldBackM <T, A, M, S> ( Func<S, Func<A, K<M, S>>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method K<M, S> foldBackM <T, A, M, S> ( Func<S, A, K<M, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method A fold <T, A> (K<T, A> tm) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A foldWhile <T, A> (Func<(A State, A Value), bool> predicate, K<T, A> tm) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A foldUntil <T, A> (Func<(A State, A Value), bool> predicate, K<T, A> tm) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method B foldMap <T, A, B> (Func<A, B> f, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B foldMapWhile <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B foldMapUntil <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B foldMapBack <T, A, B> (Func<A, B> f, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B foldMapBackWhile <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B foldMapBackUntil <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method Seq<A> toSeq <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method Lst<A> toLst <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method Arr<A> toArr <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method Iterable<A> toIterable <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method bool isEmpty <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

List of elements of a structure, from left to right

method int count <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

Returns the size/length of a finite structure as an int. The default implementation just counts elements starting with the leftmost.

Instances for structures that can compute the element count faster than via element-by-element counting, should provide a specialised implementation.

method bool exists <T, A> (Func<A, bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>

Does an element that fits the predicate occur in the structure?

method bool forAll <T, A> (Func<A, bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>

Does the predicate hold for all elements in the structure?

method bool contains <EqA, T, A> (A value, K<T, A> ta) Source #

where EqA : Eq<A>
where T : Foldable<T>

Does the element exist in the structure?

method bool contains <T, A> (A value, K<T, A> ta) Source #

where T : Foldable<T>

Does the element exist in the structure?

method Option<A> find <T, A> (Func<A, bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>

Find the first element that match the predicate

method Option<A> findBack <T, A> (Func<A, bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>

Find the last element that match the predicate

method Seq<A> findAll <T, A> (Func<A, bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>

Find the elements that match the predicate

method Seq<A> findAllBack <T, A> (Func<A, bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>

Find the elements that match the predicate

method A sum <T, A> (K<T, A> ta) Source #

where T : Foldable<T>
where A : IAdditionOperators<A, A, A>, IAdditiveIdentity<A, A>

Computes the sum of the numbers of a structure.

method A product <T, A> (K<T, A> ta) Source #

where T : Foldable<T>
where A : IMultiplyOperators<A, A, A>, IMultiplicativeIdentity<A, A>

Computes the product of the numbers of a structure.

method Option<A> head <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

Get the head item in the foldable or None

method Option<A> last <T, A> (K<T, A> ta) Source #

where T : Foldable<T>

Get the head item in the foldable or None

method K<F, Unit> iter <T, A, F, B> (Func<A, K<F, B>> f, K<T, A> ta) Source #

where T : Foldable<T>
where F : Applicative<F>

Map each element of a structure to an 'Applicative' action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit iter <T, A> (Action<int, A> f, K<T, A> ta) Source #

where T : Foldable<T>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit iter <T, A> (Action<A> f, K<T, A> ta) Source #

where T : Foldable<T>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Option<A> min <OrdA, T, A> (K<T, A> ta) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the minimum value in the structure

method Option<A> min <T, A> (K<T, A> ta) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the minimum value in the structure

method Option<A> max <OrdA, T, A> (K<T, A> ta) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the maximum value in the structure

method Option<A> max <T, A> (K<T, A> ta) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the maximum value in the structure

method A min <OrdA, T, A> (K<T, A> ta, A initialMin) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the minimum value in the structure

method A min <T, A> (K<T, A> ta, A initialMin) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the minimum value in the structure

method A max <OrdA, T, A> (K<T, A> ta, A initialMax) Source #

where T : Foldable<T>
where OrdA : Ord<A>

Find the maximum value in the structure

method A max <T, A> (K<T, A> ta, A initialMax) Source #

where T : Foldable<T>
where A : IComparable<A>

Find the maximum value in the structure

method A average <T, A> (K<T, A> ta) Source #

where T : Foldable<T>
where A : INumber<A>

Find the average of all the values in the structure

method B average <T, A, B> (Func<A, B> f, K<T, A> ta) Source #

where T : Foldable<T>
where B : INumber<B>

Find the average of all the values in the structure

method Option<A> at <T, A> (K<T, A> ta, Index index) Source #

where T : Foldable<T>

Find the element at the specified index or None if out of range

method (Seq<A> True, Seq<A> False) partition <T, A> (Func<A, bool> f, K<T, A> ta) Source #

where T : Foldable<T>

Partition a foldable into two sequences based on a predicate

Parameters

type A

Bound value type

param f

Predicate function

param ta

Foldable structure

returns

Partitioned structure

class Prelude Source #

Methods

method S foldWhile <T, A, S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldWhile <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackWhile <T, A, S> ( Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackWhile <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldWhileM <T, A, M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldWhileM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackWhileM <T, A, M, S> ( Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackWhileM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldUntil <T, A, S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldUntil <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldUntilM <T, A, M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>
where T : Foldable<T>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldUntilM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>
where T : Foldable<T>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackUntil <T, A, S> ( Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S foldBackUntil <T, A, S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackUntilM <T, A, M, S> ( Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> foldBackUntilM <T, A, M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S fold <T, A, S> (Func<A, Func<S, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S fold <T, A, S> (Func<S, A, S> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method K<M, S> foldM <T, A, M, S> ( Func<A, Func<S, K<M, S>>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method K<M, S> foldM <T, A, M, S> ( Func<S, A, K<M, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S foldBack <T, A, S> (Func<S, Func<A, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method S foldBack <T, A, S> (Func<S, A, S> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method K<M, S> foldBackM <T, A, M, S> ( Func<S, Func<A, K<M, S>>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method K<M, S> foldBackM <T, A, M, S> ( Func<S, A, K<M, S>> f, S initialState, K<T, A> ta) Source #

where T : Foldable<T>
where M : Monad<M>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method A fold <T, A> (K<T, A> tm) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A foldWhile <T, A> (Func<(A State, A Value), bool> predicate, K<T, A> tm) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A foldUntil <T, A> (Func<(A State, A Value), bool> predicate, K<T, A> tm) Source #

where T : Foldable<T>
where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method B foldMap <T, A, B> (Func<A, B> f, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B foldMapWhile <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B foldMapUntil <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B foldMapBack <T, A, B> (Func<A, B> f, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B foldMapBackWhile <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B foldMapBackUntil <T, A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where T : Foldable<T>
where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method K<F, Unit> iter <T, A, F, B> (Func<A, K<F, B>> f, K<T, A> ta) Source #

where T : Foldable<T>
where F : Applicative<F>

Map each element of a structure to an 'Applicative' action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit iter <T, A> (Action<int, A> f, K<T, A> ta) Source #

where T : Foldable<T>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit iter <T, A> (Action<A> f, K<T, A> ta) Source #

where T : Foldable<T>

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method (Seq<A> True, Seq<A> False) partition <T, A> (Func<A, bool> f, K<T, A> ta) Source #

where T : Foldable<T>

Partition a foldable into two sequences based on a predicate

Parameters

type A

Bound value type

param f

Predicate function

param ta

Foldable structure

returns

Partitioned structure

interface Foldable <out T> Source #

where T : Foldable<T>

Methods

method S FoldWhile <A, S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldBackWhile <A, S> ( Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldMaybe <A, S> ( Func<S, Func<A, Option<S>>> f, S initialState, K<T, A> ta) Source #

Fold until the Option returns None

Parameters

type A

Value type

type S

State type

param f

Fold function

param initialState

Initial state for the fold

param ta

Foldable structure

returns

Aggregated value

method S FoldBackMaybe <A, S> ( Func<A, Func<S, Option<S>>> f, S initialState, K<T, A> ta) Source #

Fold until the Option returns None

Parameters

type A

Value type

type S

State type

param f

Fold function

param initialState

Initial state for the fold

param ta

Foldable structure

returns

Aggregated value

method K<M, S> FoldWhileM <A, M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>

Same behaviour as Fold but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldBackWhileM <A, M, S> ( Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S FoldUntil <A, S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

Same behaviour as Fold but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldUntilM <A, M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>

method S FoldBackUntil <A, S> ( Func<S, Func<A, S>> f, Func<(S State, A Value), bool> predicate, S initialState, K<T, A> ta) Source #

Same behaviour as FoldBack but allows early exit of the operation once the predicate function becomes false for the state/value pair

method K<M, S> FoldBackUntilM <A, M, S> ( Func<S, Func<A, K<M, S>>> f, Func<A, bool> predicate, S initialState, K<T, A> ta) Source #

where M : Monad<M>

Same behaviour as FoldBack but the fold operation returns a monadic type and allows early exit of the operation once the predicate function becomes false for the state/value pair

method S Fold <A, S> (Func<A, Func<S, S>> f, S initialState, K<T, A> ta) Source #

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method K<M, S> FoldM <A, M, S> ( Func<A, Func<S, K<M, S>>> f, S initialState, K<T, A> ta) Source #

where M : Monad<M>

Right-associative fold of a structure, lazy in the accumulator.

In the case of lists, 'Fold', when applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left.

method S FoldBack <A, S> (Func<S, Func<A, S>> f, S initialState, K<T, A> ta) Source #

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method K<M, S> FoldBackM <A, M, S> ( Func<S, Func<A, K<M, S>>> f, S initialState, K<T, A> ta) Source #

where M : Monad<M>

Left-associative fold of a structure, lazy in the accumulator. This is rarely what you want, but can work well for structures with efficient right-to-left sequencing and an operator that is lazy in its left argument.

In the case of lists, 'FoldLeft', 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. Like all left-associative folds, `FoldBack' will diverge if given an infinite list.

method A Fold <A> (K<T, A> tm) Source #

where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A FoldWhile <A> (Func<(A State, A Value), bool> predicate, K<T, A> tm) Source #

where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method A FoldUntil <A> (Func<(A State, A Value), bool> predicate, K<T, A> tm) Source #

where A : Monoid<A>

Given a structure with elements whose type is a Monoid, combine them via the monoid's Append operator. This fold is right-associative and lazy in the accumulator. When you need a strict left-associative fold, use 'foldMap'' instead, with 'id' as the map.

method B FoldMap <A, B> (Func<A, B> f, K<T, A> ta) Source #

where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapWhile <A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapUntil <A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where B : Monoid<B>

Map each element of the structure into a monoid, and combine the results with Append. This fold is right-associative and lazy in the accumulator. For strict left-associative folds consider FoldMapBack instead.

method B FoldMapBack <A, B> (Func<A, B> f, K<T, A> ta) Source #

where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B FoldMapBackWhile <A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method B FoldMapBackUntil <A, B> (Func<A, B> f, Func<(B State, A Value), bool> predicate, K<T, A> ta) Source #

where B : Monoid<B>

A left-associative variant of 'FoldMap' that is strict in the accumulator. Use this method for strict reduction when partial results are merged via Append.

method Seq<A> ToSeq <A> (K<T, A> ta) Source #

List of elements of a structure, from left to right

method Lst<A> ToLst <A> (K<T, A> ta) Source #

List of elements of a structure, from left to right

method Arr<A> ToArr <A> (K<T, A> ta) Source #

List of elements of a structure, from left to right

method Iterable<A> ToIterable <A> (K<T, A> ta) Source #

List of elements of a structure, from left to right

method bool IsEmpty <A> (K<T, A> ta) Source #

List of elements of a structure, from left to right

method int Count <A> (K<T, A> ta) Source #

Returns the size/length of a finite structure as an int. The default implementation just counts elements starting with the leftmost.

Instances for structures that can compute the element count faster than via element-by-element counting, should provide a specialised implementation.

method bool Exists <A> (Func<A, bool> predicate, K<T, A> ta) Source #

Does an element that fits the predicate occur in the structure?

method bool ForAll <A> (Func<A, bool> predicate, K<T, A> ta) Source #

Does the predicate hold for all elements in the structure?

method bool Contains <EqA, A> (A value, K<T, A> ta) Source #

where EqA : Eq<A>

Does the element exist in the structure?

method bool Contains <A> (A value, K<T, A> ta) Source #

Does the element exist in the structure?

method Option<A> Find <A> (Func<A, bool> predicate, K<T, A> ta) Source #

Find the first element that match the predicate

method Option<A> FindBack <A> (Func<A, bool> predicate, K<T, A> ta) Source #

Find the last element that match the predicate

method Seq<A> FindAll <A> (Func<A, bool> predicate, K<T, A> ta) Source #

Find the the elements that match the predicate

method Seq<A> FindAllBack <A> (Func<A, bool> predicate, K<T, A> ta) Source #

Find the the elements that match the predicate

method A Sum <A> (K<T, A> ta) Source #

where A : IAdditionOperators<A, A, A>, IAdditiveIdentity<A, A>

Computes the sum of the numbers of a structure.

method A Product <A> (K<T, A> ta) Source #

where A : IMultiplyOperators<A, A, A>, IMultiplicativeIdentity<A, A>

Computes the product of the numbers of a structure.

method Option<A> Head <A> (K<T, A> ta) Source #

Get the head item in the foldable or None

method Option<A> Last <A> (K<T, A> ta) Source #

Get the head item in the foldable or None

method K<F, Unit> Iter <A, F, B> (Func<A, K<F, B>> f, K<T, A> ta) Source #

where F : Applicative<F>

Map each element of a structure to an 'Applicative' action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit Iter <A> (Action<A> f, K<T, A> ta) Source #

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Unit Iter <A> (Action<int, A> f, K<T, A> ta) Source #

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see Traversable.traverse.

method Option<A> Min <OrdA, A> (K<T, A> ta) Source #

where OrdA : Ord<A>

Find the minimum value in the structure

method Option<A> Min <A> (K<T, A> ta) Source #

where A : IComparable<A>

Find the minimum value in the structure

method Option<A> Max <OrdA, A> (K<T, A> ta) Source #

where OrdA : Ord<A>

Find the maximum value in the structure

method Option<A> Max <A> (K<T, A> ta) Source #

where A : IComparable<A>

Find the maximum value in the structure

method A Min <OrdA, A> (K<T, A> ta, A initialMin) Source #

where OrdA : Ord<A>

Find the minimum value in the structure

method A Min <A> (K<T, A> ta, A initialMin) Source #

where A : IComparable<A>

Find the minimum value in the structure

method A Max <OrdA, A> (K<T, A> ta, A initialMax) Source #

where OrdA : Ord<A>

Find the maximum value in the structure

method A Max <A> (K<T, A> ta, A initialMax) Source #

where A : IComparable<A>

Find the maximum value in the structure

method A Average <A> (K<T, A> ta) Source #

where A : INumber<A>

Find the average of all the values in the structure

method B Average <A, B> (Func<A, B> f, K<T, A> ta) Source #

where B : INumber<B>

Find the average of all the values in the structure

method Option<A> At <A> (K<T, A> ta, Index index) Source #

Find the element at the specified index or None if out of range

method (Seq<A> True, Seq<A> False) Partition <A> (Func<A, bool> f, K<T, A> ta) Source #

Partition a foldable into two sequences based on a predicate

Parameters

type A

Bound value type

param f

Predicate function

param ta

Foldable structure

returns

Partitioned structure