Contents
- Iterable <A>
- FromSpan (ReadOnlySpan<A> ma)
- Count ()
- CountIO ()
- AsEnumerable (CancellationToken token = default)
- AsEnumerableIO ()
- AsAsyncEnumerable ([EnumeratorCancellation] CancellationToken token = default)
- AsAsyncEnumerableIO ()
- Reverse ()
- Add (A item)
- Cons (A item)
- Iter (Action<A> f)
- IterIO (Action<A> f)
- Iter (Action<A, int> f)
- IterIO (Action<A, int> f, int offset = 0)
- Map <B> (Func<A, B> f)
- Map <B> (Func<A, int, B> f, int offset = 0)
- Filter (Func<A, bool> f)
- EqualsIO <EqA> (Iterable<A>? other)
- EqualsIO (Iterable<A>? other)
- Equals <EqA> (Iterable<A>? other)
- Equals (Iterable<A>? other)
- GetAsyncEnumerator (CancellationToken cancellationToken = default)
- Equals (object? obj)
- == (Iterable<A>? lhs, Iterable<A>? rhs)
- != (Iterable<A>? lhs, Iterable<A>? rhs)
- Combine (Iterable<A> y)
- Concat (IEnumerable<A> items)
- Concat (IAsyncEnumerable<A> items)
- Concat (Iterable<A> items)
- Distinct <EqA> ()
- Distinct ()
- Traverse <F, B> (Func<A, K<F, B>> f)
- TraverseM <M, B> (Func<A, K<M, B>> f)
- TraverseIO <F, B> (Func<A, K<F, B>> f, K<Iterable, A> kta)
- Bind <B> (Func<A, K<Iterable, B>> f)
- Bind <B> (Func<A, Iterable<B>> f)
- FoldWhile <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldWhile <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldWhileIO <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldWhileIO <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldUntil <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldUntil <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldUntilIO <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldUntilIO <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState)
- FoldMaybe <S> ( Func<S, Func<A, Option<S>>> f, S initialState)
- FoldMaybe <S> ( Func<S, A, Option<S>> f, S initialState)
- FoldMaybeIO <S> ( Func<S, Func<A, Option<S>>> f, S initialState)
- FoldMaybeIO <S> ( Func<S, A, Option<S>> f, S initialState)
- FoldWhileM <M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState)
- FoldWhileM <M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState)
- FoldUntilM <M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState)
- FoldUntilM <M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState)
- Fold <S> (Func<A, Func<S, S>> f, S initialState)
- Fold <S> (Func<S, A, S> f, S initialState)
- FoldIO <S> (Func<A, Func<S, S>> f, S initialState)
- FoldIO <S> (Func<S, A, S> f, S initialState)
- FoldM <M, S> ( Func<A, Func<S, K<M, S>>> f, S initialState)
- FoldM <M, S> ( Func<S, A, K<M, S>> f, S initialState)
- FoldMap <B> (Func<A, B> f)
- FoldMapIO <B> (Func<A, B> f)
- FoldMapWhile <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate)
- FoldMapWhileIO <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate)
- FoldMapUntil <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate)
- FoldMapUntilIO <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate)
- Any ()
- Intersperse (A value)
- CompareToIO (object? obj)
- CompareTo (object? obj)
- CompareToIO (Iterable<A>? other)
- CompareTo (Iterable<A>? other)
- CompareToIO <OrdA> (Iterable<A>? rhs)
- CompareTo <OrdA> (Iterable<A>? rhs)
- ToString ()
- ToStringIO ()
- ToFullString (string separator = ", ")
- ToFullStringIO (string separator = ", ")
- ToFullArrayString (string separator = ", ")
- ToFullArrayStringIO (string separator = ", ")
- Tail
- Skip (int amount)
- Take (int amount)
- TakeWhile (Func<A, bool> pred)
- TakeWhile (Func<A, int, bool> pred)
- PartitionIO (Func<A, bool> predicate)
- Partition (Func<A, bool> predicate)
- Cast <B> ()
- Zip <B> (Iterable<B> rhs)
- Zip <B, C> (Iterable<B> rhs, Func<A, B, C> zipper)
- Empty
- + (Iterable<A> x, Iterable<A> y)
- + (A x, Iterable<A> y)
- + (Iterable<A> x, A y)
- Choose (Iterable<A> rhs)
- Choose (Memo<Iterable, A> rhs)
- | (Iterable<A> x, K<Iterable, A> y)
- | (K<Iterable, A> x, Iterable<A> y)
- | (Iterable<A> x, Memo<Iterable, A> y)
- > (Iterable<A> x, Iterable<A> y)
- >= (Iterable<A> x, Iterable<A> y)
- < (Iterable<A> x, Iterable<A> y)
- <= (Iterable<A> x, Iterable<A> y)
- Select <B> (Func<A, B> f)
- Select <B> (Func<A, int, B> f)
- Where (Func<A, bool> f)
- SelectMany <B> (Func<A, Iterable<B>> bind)
- SelectMany <B, C> (Func<A, Iterable<B>> bind, Func<A, B, C> project)
- SelectMany <B> (Func<A, IEnumerable<B>> bind)
- SelectMany <B, C> (Func<A, IEnumerable<B>> bind, Func<A, B, C> project)
- GetEnumerator ()
- GetHashCode ()
- AdditiveIdentity
- Iterable
- flatten <A> (Iterable<Iterable<A>> ma)
- empty <A> ()
- singleton <A> (A value)
- create <A> ()
- create <A> (params A[] items)
- createRange <A> (ReadOnlySpan<A> items)
- createRange <A> (IEnumerable<A> items)
- createRange <A> (IAsyncEnumerable<A> items)
- createRange <A> (IO<IAsyncEnumerable<A>> items)
- generate <A> (int count, Func<int, A> generator)
- repeat <A> (A item, int count)
- head <A> (Iterable<A> list)
- choose <A, B> (Iterable<A> list, Func<A, Option<B>> selector)
- rev <A> (Iterable<A> list)
- zip <A, B, C> (Iterable<A> list, Iterable<B> other, Func<A, B, C> zipper)
- zip <A, B> (Iterable<A> list, Iterable<B> other)
- distinct <A> (Iterable<A> list)
- distinct <EqA, A> (Iterable<A> list)
- take <A> (Iterable<A> list, int count)
- takeWhile <A> (Iterable<A> list, Func<A, bool> pred)
- takeWhile <A> (Iterable<A> list, Func<A, int, bool> pred)
Sub modules
| DSL |
| Extensions |
| Operators |
| Prelude |
| Trait |
Lazy sequence
This is a lightweight wrapper around IEnumerable that also implements traits
that make it play nice with other types in this library: Monad, Traversable, etc.
Parameters
| type | A | Type of the values in the sequence |
Properties
property Iterable<A> AdditiveIdentity Source #
Get the additive-identity, i.e. the monoid-zero. Which is the empty sequence/
Methods
Number of items in the sequence.
NOTE: This will force evaluation of the sequence
method IEnumerable<A> AsEnumerable (CancellationToken token = default) Source #
Stream as an enumerable
method IO<IEnumerable<A>> AsEnumerableIO () Source #
Stream as an enumerable
method IAsyncEnumerable<A> AsAsyncEnumerable ([EnumeratorCancellation] CancellationToken token = default) Source #
Stream as an enumerable
method IO<IAsyncEnumerable<A>> AsAsyncEnumerableIO () Source #
Stream as an enumerable
method Iterable<A> Add (A item) Source #
Add an item to the end of the sequence
This does not force evaluation of the whole lazy sequence, nor does it cause exponential iteration issues when repeated adds occur.
method Iterable<A> Cons (A item) Source #
Add an item to the beginning of the sequence
This does not force evaluation of the whole lazy sequence, nor does it cause exponential iteration issues when repeated cons occur.
method Unit Iter (Action<A> f) Source #
Impure iteration of the bound values in the structure
Parameters
| returns | Returns the original unmodified structure | |
method IO<Unit> IterIO (Action<A> f) Source #
Pure iteration of the bound values in the structure
Parameters
| returns | Returns the original unmodified structure | |
method Unit Iter (Action<A, int> f) Source #
Impure iteration of the bound values in the structure
Parameters
| returns | Returns the original unmodified structure | |
method IO<Unit> IterIO (Action<A, int> f, int offset = 0) Source #
Pure iteration of the bound values in the structure
Parameters
| returns | Returns the original unmodified structure | |
method Iterable<B> Map <B> (Func<A, B> f) Source #
Map the sequence using the function provided
Parameters
| type | B | |
| param | f | Mapping function |
| returns | Mapped sequence | |
method Iterable<B> Map <B> (Func<A, int, B> f, int offset = 0) Source #
Map the sequence using the function provided
Parameters
| type | B | |
| param | f | Mapping function |
| returns | Mapped sequence | |
method Iterable<A> Filter (Func<A, bool> f) Source #
Filter the items in the sequence
Parameters
| param | f | Predicate to apply to the items |
| returns | Filtered sequence | |
method IAsyncEnumerator<A> GetAsyncEnumerator (CancellationToken cancellationToken = default) Source #
method Iterable<A> Concat (IEnumerable<A> items) Source #
Add a range of items to the end of the sequence
method Iterable<A> Concat (IAsyncEnumerable<A> items) Source #
Add a range of items to the end of the sequence
method Iterable<A> Concat (Iterable<A> items) Source #
Add a range of items to the end of the sequence
method Iterable<A> Distinct <EqA> () Source #
Return a new sequence with all duplicate values removed
Parameters
| type | T | sequence item type |
| returns | A new sequence with all duplicate values removed | |
method Iterable<A> Distinct () Source #
Return a new sequence with all duplicate values removed
Parameters
| type | T | sequence item type |
| returns | A new sequence with all duplicate values removed | |
method K<F, Iterable<B>> Traverse <F, B> (Func<A, K<F, B>> f) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
NOTE: This method will eagerly evaluate the iterable. If you're working with
an asynchronous sequence, then it is advised to use TraverseIO.
Parameters
| type | F | Applicative functor trait |
| type | B | Bound value (output) |
| param | f | |
| param | ta | Traversable structure |
method K<M, Iterable<B>> TraverseM <M, B> (Func<A, K<M, B>> f) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
NOTE: This method will eagerly evaluate the iterable. If you're working with
an asynchronous sequence, then it is advised to use TraverseIO.
Parameters
| type | M | Monad trait |
| type | B | Bound value (output) |
| param | f | |
| param | ta | Traversable structure |
method K<F, Iterable<B>> TraverseIO <F, B> (Func<A, K<F, B>> f, K<Iterable, A> kta) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
Parameters
| type | M | Monad trait |
| type | B | Bound value (output) |
| param | f | |
| param | ta | Traversable structure |
method Iterable<B> Bind <B> (Func<A, K<Iterable, B>> f) Source #
Monadic bind (flatmap) of the sequence
Parameters
| type | B | Bound return value type |
| param | f | Bind function |
| returns | Flat-mapped sequence | |
method Iterable<B> Bind <B> (Func<A, Iterable<B>> f) Source #
Monadic bind (flatmap) of the sequence
Parameters
| type | B | Bound return value type |
| param | f | Bind function |
| returns | Flat-mapped sequence | |
method S FoldWhile <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method S FoldWhile <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method IO<S> FoldWhileIO <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method IO<S> FoldWhileIO <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method S FoldUntil <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method S FoldUntil <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method IO<S> FoldUntilIO <S> ( Func<A, Func<S, S>> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method IO<S> FoldUntilIO <S> ( Func<S, A, S> f, Func<(S State, A Value), bool> predicate, S initialState) Source #
Fold over the sequence from the left, accumulating state in f
Parameters
| type | S | State value type |
| param | f | Fold function to apply to each item in the sequence |
| param | predicate | Continue while the predicate returns true for any pair of value and state.
This is tested before the value is processed and the state is updated. So, use |
| param | initialState | Initial state value |
| returns | Resulting state | |
method S FoldMaybe <S> ( Func<S, Func<A, Option<S>>> f, S initialState) Source #
Fold until the Option returns None
Parameters
| 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 <S> ( Func<S, A, Option<S>> f, S initialState) Source #
Fold until the Option returns None
Parameters
| type | S | State type |
| param | f | Fold function |
| param | initialState | Initial state for the fold |
| param | ta | Foldable structure |
| returns | Aggregated value | |
method IO<S> FoldMaybeIO <S> ( Func<S, Func<A, Option<S>>> f, S initialState) Source #
Fold until the Option returns None
Parameters
| type | S | State type |
| param | f | Fold function |
| param | initialState | Initial state for the fold |
| param | ta | Foldable structure |
| returns | Aggregated value | |
method IO<S> FoldMaybeIO <S> ( Func<S, A, Option<S>> f, S initialState) Source #
Fold until the Option returns None
Parameters
| 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 <M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState) Source #
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 <M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState) Source #
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 <M, S> ( Func<A, Func<S, K<M, S>>> f, Func<A, bool> predicate, S initialState) Source #
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 <M, S> ( Func<S, A, K<M, S>> f, Func<A, bool> predicate, S initialState) Source #
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 Fold <S> (Func<A, Func<S, S>> f, S initialState) 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 S Fold <S> (Func<S, A, S> f, S initialState) 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 IO<S> FoldIO <S> (Func<A, Func<S, S>> f, S initialState) 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 IO<S> FoldIO <S> (Func<S, A, S> f, S initialState) 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 <M, S> ( Func<A, Func<S, K<M, S>>> f, S initialState) 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 <M, S> ( Func<S, A, K<M, S>> f, S initialState) 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 B FoldMap <B> (Func<A, B> f) Source #
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 IO<B> FoldMapIO <B> (Func<A, B> f) Source #
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 <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #
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 IO<B> FoldMapWhileIO <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #
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 <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #
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 IO<B> FoldMapUntilIO <B> (Func<A, B> f, Func<(B State, A Value), bool> predicate) Source #
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.
Returns true if the sequence has items in it
Parameters
| returns | True if the sequence has items in it | |
method Iterable<A> Intersperse (A value) Source #
Inject a value in between each item in the sequence
Parameters
| type | A | Bound type |
| param | ma | Sequence to inject values into |
| param | value | Item to inject |
| returns | A sequence with the values injected | |
method IO<int> CompareToIO (object? obj) Source #
method IO<int> CompareToIO (Iterable<A>? other) Source #
method IO<int> CompareToIO <OrdA> (Iterable<A>? rhs) Source #
Compare to another sequence
method int CompareTo <OrdA> (Iterable<A>? rhs) Source #
Compare to another sequence
method string ToString () Source #
Format the collection as [a, b, c, ...]
The ellipsis is used for collections over 50 items
To get a formatted string with all the items, use ToFullString
or ToFullArrayString.
method IO<string> ToStringIO () Source #
Format the collection as [a, b, c, ...]
The ellipsis is used for collections over 50 items
To get a formatted string with all the items, use ToFullString
or ToFullArrayString.
method string ToFullString (string separator = ", ") Source #
Format the collection as a, b, c, ...
method IO<string> ToFullStringIO (string separator = ", ") Source #
Format the collection as a, b, c, ...
method string ToFullArrayString (string separator = ", ") Source #
Format the collection as [a, b, c, ...]
method IO<string> ToFullArrayStringIO (string separator = ", ") Source #
Format the collection as [a, b, c, ...]
method Iterable<A> TakeWhile (Func<A, bool> pred) Source #
Iterate the sequence, yielding items if they match the predicate provided, and stopping as soon as one doesn't
Parameters
| returns | A new sequence with the first items that match the predicate | |
method Iterable<A> TakeWhile (Func<A, int, bool> pred) Source #
Iterate the sequence, yielding items if they match the predicate provided; and stopping as soon as one doesn't. An index value is also provided to the predicate function.
Parameters
| returns | A new sequence with the first items that match the predicate | |
method IO<(Iterable<A> First, Iterable<A> Second)> PartitionIO (Func<A, bool> predicate) Source #
Partition a list into two based on a predicate
Parameters
| param | predicate | True if the item goes in the first list, false for the second list |
| returns | Pair of lists | |
method (Iterable<A> First, Iterable<A> Second) Partition (Func<A, bool> predicate) Source #
Partition a list into two based on a predicate
Parameters
| param | predicate | True if the item goes in the first list, false for the second list |
| returns | Pair of lists | |
method Iterable<B> Cast <B> () Source #
Cast items to another type
Any item in the sequence that can't be cast to a B will be dropped from the result
method Iterable<(A First, B Second)> Zip <B> (Iterable<B> rhs) Source #
Zip two iterables into pairs
method Iterable<C> Zip <B, C> (Iterable<B> rhs, Func<A, B, C> zipper) Source #
Zip two iterables into pairs
method Iterable<A> Choose (Iterable<A> rhs) Source #
If this sequence is empty, return the other sequence, otherwise return this sequence.
Parameters
| param | rhs | Right hand side of the operator |
| returns | A choice between two sequences based | |
method Iterable<A> Choose (Memo<Iterable, A> rhs) Source #
If this sequence is empty, return the other sequence, otherwise return this sequence.
Parameters
| param | rhs | Right hand side of the operator |
| returns | A choice between two sequences based | |
method Iterable<B> Select <B> (Func<A, B> f) Source #
Map the sequence using the function provided
Parameters
| type | B | |
| param | f | Mapping function |
| returns | Mapped sequence | |
method Iterable<B> Select <B> (Func<A, int, B> f) Source #
Map the sequence using the function provided
Parameters
| type | B | |
| param | f | Mapping function |
| returns | Mapped sequence | |
method Iterable<A> Where (Func<A, bool> f) Source #
Filter the items in the sequence
Parameters
| param | f | Predicate to apply to the items |
| returns | Filtered sequence | |
method Iterable<B> SelectMany <B> (Func<A, Iterable<B>> bind) Source #
Monadic bind (flatmap) of the sequence
Parameters
| type | B | Bound return value type |
| param | bind | Bind function |
| returns | Flat-mapped sequence | |
method Iterable<C> SelectMany <B, C> (Func<A, Iterable<B>> bind, Func<A, B, C> project) Source #
Monadic bind (flatmap) of the sequence
Parameters
| type | B | Bound return value type |
| param | bind | Bind function |
| returns | Flat-mapped sequence | |
method Iterable<B> SelectMany <B> (Func<A, IEnumerable<B>> bind) Source #
Monadic bind (flatmap) of the sequence
Parameters
| type | B | Bound return value type |
| param | bind | Bind function |
| returns | Flat-mapped sequence | |
method Iterable<C> SelectMany <B, C> (Func<A, IEnumerable<B>> bind, Func<A, B, C> project) Source #
Monadic bind (flatmap) of the sequence
Parameters
| type | B | Bound return value type |
| param | bind | Bind function |
| returns | Flat-mapped sequence | |
method IEnumerator<A> GetEnumerator () Source #
method int GetHashCode () Source #
Get the hash code for all the items in the sequence, or 0 if empty
Parameters
| returns | ||
Operators
Cons sequence module Represents a sequence of values in a similar way to IEnumerable, but without the issues of multiple evaluation for key LINQ operators like Skip, Count, etc.
Parameters
| type | A | Type of the values in the sequence |
Methods
method Iterable<A> create <A> (params A[] items) Source #
Create a sequence from an initial set of items
Parameters
| param | items | Items |
| returns | sequence | |
method Iterable<A> createRange <A> (ReadOnlySpan<A> items) Source #
Create a sequence from an initial set of items
Parameters
| param | items | Items |
| returns | sequence | |
method Iterable<A> createRange <A> (IEnumerable<A> items) Source #
Create a sequence from an initial set of items
Parameters
| param | items | Items |
| returns | sequence | |
method Iterable<A> createRange <A> (IAsyncEnumerable<A> items) Source #
Create a sequence from an initial set of items
Parameters
| param | items | Items |
| returns | sequence | |
method Iterable<A> createRange <A> (IO<IAsyncEnumerable<A>> items) Source #
Create a sequence from an initial set of items
Parameters
| param | items | Items |
| returns | sequence | |
method Iterable<A> generate <A> (int count, Func<int, A> generator) Source #
Generates a sequence of A using the provided delegate to initialise each item.
method Iterable<A> repeat <A> (A item, int count) Source #
Generates a sequence that contains one repeated value.
method Option<A> head <A> (Iterable<A> list) Source #
Get the item at the head (first) of the sequence or None if the sequence is empty
Parameters
| param | list | sequence |
| returns | Optional head item | |
method Iterable<B> choose <A, B> (Iterable<A> list, Func<A, Option<B>> selector) Source #
Applies the given function 'selector' to each element of the sequence. Returns the sequence of results for each element where the function returns Some(f(x)).
Parameters
| type | A | sequence item type |
| param | list | sequence |
| param | selector | Selector function |
| returns | Mapped and filtered sequence | |
method Iterable<A> rev <A> (Iterable<A> list) Source #
Reverses the sequence (Reverse in LINQ)
Parameters
| type | A | sequence item type |
| param | list | sequence to reverse |
| returns | Reversed sequence | |
method Iterable<C> zip <A, B, C> (Iterable<A> list, Iterable<B> other, Func<A, B, C> zipper) Source #
Joins two sequences together either into a single sequence using the join function provided
Parameters
| param | list | First sequence to join |
| param | other | Second sequence to join |
| param | zipper | Join function |
| returns | Joined sequence | |
method Iterable<(A First, B Second)> zip <A, B> (Iterable<A> list, Iterable<B> other) Source #
Joins two sequences together either into an sequence of tuples
Parameters
| param | list | First sequence to join |
| param | other | Second sequence to join |
| param | zipper | Join function |
| returns | Joined sequence of tuples | |
method Iterable<A> distinct <A> (Iterable<A> list) Source #
Return a new sequence with all duplicate values removed
Parameters
| type | A | sequence item type |
| param | list | sequence |
| returns | A new sequence with all duplicate values removed | |
method Iterable<A> distinct <EqA, A> (Iterable<A> list) Source #
Return a new sequence with all duplicate values removed
Parameters
| type | A | sequence item type |
| param | list | sequence |
| returns | A new sequence with all duplicate values removed | |
method Iterable<A> take <A> (Iterable<A> list, int count) Source #
Returns a new sequence with the first 'count' items from the sequence provided
Parameters
| type | A | sequence item type |
| param | list | sequence |
| param | count | Number of items to take |
| returns | A new sequence with the first 'count' items from the sequence provided | |
method Iterable<A> takeWhile <A> (Iterable<A> list, Func<A, bool> pred) Source #
Iterate the sequence, yielding items if they match the predicate provided, and stopping as soon as one doesn't
Parameters
| type | A | sequence item type |
| param | list | sequence |
| param | count | Number of items to take |
| returns | A new sequence with the first items that match the predicate | |
method Iterable<A> takeWhile <A> (Iterable<A> list, Func<A, int, bool> pred) Source #
Iterate the sequence, yielding items if they match the predicate provided, and stopping as soon as one doesn't. An index value is also provided to the predicate function.
Parameters
| type | A | sequence item type |
| param | list | sequence |
| param | count | Number of items to take |
| returns | A new sequence with the first items that match the predicate | |