Contents
- SeqExtensions
- As <A> (this K<Seq, A> xs)
- Flatten <A> (this Seq<Seq<A>> ma)
- Choose <A, B> (this Seq<A> list, Func<A, Option<B>> selector)
- Choose <A, B> (this Seq<A> list, Func<int, A, Option<B>> selector)
- Rev <T> (this Seq<T> list)
- Append <T> (this Seq<T> lhs, Seq<T> rhs)
- Append <T> (this Seq<T> x, Seq<Seq<T>> xs)
- Scan <S, T> (this Seq<T> list, S state, Func<S, T, S> folder)
- ScanBack <S, T> (this Seq<T> list, S state, Func<S, T, S> folder)
- Zip <T, U, V> (this Seq<T> list, Seq<U> other, Func<T, U, V> zipper)
- Zip <T, U> (this Seq<T> list, Seq<U> other)
- Distinct <T> (this Seq<T> list)
- Distinct <EQ, T> (this Seq<T> list)
- Distinct <T, K> (this Seq<T> list, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = default)
- Tails <A> (this Seq<A> self)
- Span <T> (this Seq<T> self, Func<T, bool> pred)
- AsQueryable <A> (this Seq<A> source)
- SeqExtensions
class SeqExtensions Source #
Methods
method Seq<B> Choose <A, B> (this Seq<A> list, Func<A, Option<B>> selector) Source #
Applies the given function 'selector' to each element of the sequence. Returns the sequence comprised of the 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 Seq<B> Choose <A, B> (this Seq<A> list, Func<int, A, Option<B>> selector) Source #
Applies the given function 'selector' to each element of the sequence. Returns the sequence comprised of the results for each element where the function returns Some(f(x)). An index value is passed through to the selector function also.
Parameters
| type | A | sequence item type |
| param | list | sequence |
| param | selector | Selector function |
| returns | Mapped and filtered sequence | |
method Seq<T> Rev <T> (this Seq<T> list) Source #
Reverses the sequence (Reverse in LINQ)
Parameters
| type | T | sequence item type |
| param | list | sequence to reverse |
| returns | Reversed sequence | |
method Seq<T> Append <T> (this Seq<T> lhs, Seq<T> rhs) Source #
Concatenate two sequences (Concat in LINQ)
Parameters
| type | T | sequence item type |
| param | lhs | First sequence |
| param | rhs | Second sequence |
| returns | Concatenated sequence | |
method Seq<T> Append <T> (this Seq<T> x, Seq<Seq<T>> xs) Source #
Concatenate a sequence and a sequence of sequences
Parameters
| type | T | List item type |
| param | lhs | First list |
| param | rhs | Second list |
| returns | Concatenated list | |
method Seq<S> Scan <S, T> (this Seq<T> list, S state, Func<S, T, S> folder) Source #
Applies a function to each element of the sequence, threading an accumulator argument through the computation. This function takes the state argument, and applies the function to it and the first element of the sequence. Then, it passes this result into the function along with the second element, and so on. Finally, it returns the list of intermediate results and the final result.
Parameters
| type | S | State type |
| type | T | sequence item type |
| param | list | sequence to fold |
| param | state | Initial state |
| param | folder | Folding function |
| returns | Aggregate state | |
method Seq<S> ScanBack <S, T> (this Seq<T> list, S state, Func<S, T, S> folder) Source #
Applies a function to each element of the sequence (from last element to first), threading an accumulator argument through the computation. This function takes the state argument, and applies the function to it and the first element of the sequence. Then, it passes this result into the function along with the second element, and so on. Finally, it returns the list of intermediate results and the final result.
Parameters
| type | S | State type |
| type | T | Enumerable item type |
| param | list | Enumerable to fold |
| param | state | Initial state |
| param | folder | Folding function |
| returns | Aggregate state | |
method Seq<V> Zip <T, U, V> (this Seq<T> list, Seq<U> other, Func<T, U, V> 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 Seq<(T First, U Second)> Zip <T, U> (this Seq<T> list, Seq<U> 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 Seq<T> Distinct <T> (this Seq<T> list) Source #
Return a new sequence with all duplicate values removed
Parameters
| type | T | sequence item type |
| param | list | sequence |
| returns | A new sequence with all duplicate values removed | |
method Seq<T> Distinct <EQ, T> (this Seq<T> list) Source #
Return a new sequence with all duplicate values removed
Parameters
| type | T | sequence item type |
| param | list | sequence |
| returns | A new sequence with all duplicate values removed | |
method Seq<T> Distinct <T, K> (this Seq<T> list, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = default) Source #
Return a new sequence with all duplicate values removed
Parameters
| type | T | sequence item type |
| param | list | sequence |
| returns | A new sequence with all duplicate values removed | |
method Seq<Seq<A>> Tails <A> (this Seq<A> self) Source #
The tails function returns all final segments of the argument, longest first. For example:
tails(['a','b','c']) == [['a','b','c'], ['b','c'], ['c'],[]]
Parameters
| type | A | Seq item type |
| param | self | Seq |
| returns | Seq of Seq of A | |
method (Seq<T>, Seq<T>) Span <T> (this Seq<T> self, Func<T, bool> pred) Source #
Span, applied to a predicate 'pred' and a list, returns a tuple where first element is longest prefix (possibly empty) of elements that satisfy 'pred' and second element is the remainder of the list:
Parameters
| type | T | List element type |
| param | self | List |
| param | pred | Predicate |
| returns | Split list | |
Examples
Seq.span(List(1,2,3,4,1,2,3,4), x => x 〈 3) == (List(1,2),List(3,4,1,2,3,4))
Seq.span(List(1,2,3), x => x 〈 9) == (List(1,2,3),List())
Seq.span(List(1,2,3), x => x 〈 0) == (List(),List(1,2,3))
method IQueryable<A> AsQueryable <A> (this Seq<A> source) Source #
Convert to a queryable
Parameters
| returns | ||
class SeqExtensions Source #
Methods
method Seq<B> Map <A, B> (this Func<A, B> f, K<Seq, A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f provided, and
then takes the mapped value and wraps it back up into a new functor.
Parameters
| param | ma | Functor to map |
| param | f | Mapping function |
| returns | Mapped functor | |
method Seq<B> Map <A, B> (this Func<A, B> f, Seq<A> ma) Source #
Functor map operation
Unwraps the value within the functor, passes it to the map function f provided, and
then takes the mapped value and wraps it back up into a new functor.
Parameters
| param | ma | Functor to map |
| param | f | Mapping function |
| returns | Mapped functor | |
method Seq<B> Action <A, B> (this Seq<A> ma, K<Seq, B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method Seq<B> Action <A, B> (this K<Seq, A> ma, K<Seq, B> mb) Source #
Applicative action: runs the first applicative, ignores the result, and returns the second applicative
method Seq<B> Apply <A, B> (this Seq<Func<A, B>> mf, K<Seq, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma applicative-functor, passes it to the unwrapped function(s) within mf, and
then takes the resulting value and wraps it back up into a new applicative-functor.
Parameters
| param | ma | Value(s) applicative functor |
| param | mf | Mapping function(s) |
| returns | Mapped applicative functor | |
method Seq<B> Apply <A, B> (this K<Seq, Func<A, B>> mf, K<Seq, A> ma) Source #
Applicative functor apply operation
Unwraps the value within the ma applicative-functor, passes it to the unwrapped function(s) within mf, and
then takes the resulting value and wraps it back up into a new applicative-functor.
Parameters
| param | ma | Value(s) applicative functor |
| param | mf | Mapping function(s) |
| returns | Mapped applicative functor | |