- Seq <A>
- Empty
- Seq (IEnumerable<A> ma)
- Seq (ReadOnlySpan<A> ma)
- Case
- Deconstruct (out A head, out Seq<A> tail)
- head
- headOrNone
- tail
- last
- lastOrNone
- map <B> (Lens<A, B> lens)
- this []
- Add (A value)
- Concat (IEnumerable<A> items)
- Concat (in Lst<A> items)
- Concat (in ReadOnlySpan<A> items)
- Concat (in Set<A> items)
- Concat (in HashSet<A> items)
- Concat (in Arr<A> items)
- Concat (in Stck<A> items)
- Concat (IReadOnlyCollection<A> items)
- Concat (in Seq<A> rhs)
- Head
- Tail
- Init
- Last
- IsEmpty
- Count
- Length
- AsEnumerable ()
- AsStream <M> ()
- AsIterable ()
- Match <B> ( Func<B> Empty, Func<A, Seq<A>, B> Tail)
- Match <B> ( Func<B> Empty, Func<A, B> Head, Func<A, Seq<A>, B> Tail)
- Match <B> ( Func<B> Empty, Func<Seq<A>, B> Seq)
- Match <B> ( Func<B> Empty, Func<A, B> Head, Func<Seq<A>, B> Tail)
- Do (Action<A> f)
- Traverse <F, B> (Func<A, K<F, B>> f)
- TraverseM <M, B> (Func<A, K<M, B>> f)
- Map <B> (Func<A, B> f)
- Map <B> (Func<A, int, B> f)
- Select <B> (Func<A, B> f)
- Bind <B> (Func<A, Seq<B>> f)
- Bind <B> (Func<A, K<Seq, B>> f)
- SelectMany <B, C> (Func<A, Seq<B>> bind, Func<A, B, C> project)
- Filter (Func<A, bool> f)
- Where (Func<A, bool> f)
- Exists (Func<A, bool> f)
- ForAll (Func<A, bool> f)
- Any ()
- Intersperse (A value)
- GetHashCode ()
- CompareTo (object? obj)
- ToString ()
- ToFullString (string separator = ", ")
- ToFullArrayString (string separator = ", ")
- Combine (Seq<A> y)
- + (Seq<A> x, Seq<A> y)
- + (Seq<A> x, K<Seq, A> y)
- + (K<Seq, A> x, Seq<A> y)
- | (Seq<A> x, K<Seq, A> y)
- | (K<Seq, A> x, Seq<A> y)
- > (Seq<A> x, Seq<A> y)
- >= (Seq<A> x, Seq<A> y)
- < (Seq<A> x, Seq<A> y)
- <= (Seq<A> x, Seq<A> y)
- == (Seq<A> x, Seq<A> y)
- != (Seq<A> x, Seq<A> y)
- Equals (object? obj)
- Equals (Seq<A> rhs)
- Equals <EqA> (Seq<A> rhs)
- Skip (int amount)
- Take (int amount)
- TakeWhile (Func<A, bool> pred)
- TakeWhile (Func<A, int, bool> pred)
- Inits
- NonEmptyInits
- Tails
- NonEmptyTails
- Partition (Func<A, bool> predicate)
- CompareTo (Seq<A> rhs)
- CompareTo <OrdA> (Seq<A> rhs)
- Strict ()
- GetEnumerator ()
- Cast <B> ()
- AdditiveIdentity
- 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
- Map <A, B> (this Func<A, B> f, K<Seq, A> ma)
- Map <A, B> (this Func<A, B> f, Seq<A> ma)
- Action <A, B> (this Seq<A> ma, K<Seq, B> mb)
- Action <A, B> (this K<Seq, A> ma, K<Seq, B> mb)
- Apply <A, B> (this Seq<Func<A, B>> mf, K<Seq, A> ma)
- Apply <A, B> (this K<Seq, Func<A, B>> mf, K<Seq, A> ma)
- Seq
- flatten <A> (Seq<Seq<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)
- generate <A> (int count, Func<int, A> generator)
- repeat <A> (A item, int count)
- head <A> (Seq<A> list)
- last <A> (Seq<A> list)
- init <A> (Seq<A> list)
- tail <A> (Seq<A> list)
- map <A, B> (Seq<A> list, Func<A, B> map)
- map <A, B> (Seq<A> list, Func<int, A, B> map)
- filter <A> (Seq<A> list, Func<A, bool> predicate)
- choose <A, B> (Seq<A> list, Func<A, Option<B>> selector)
- choose <A, B> (Seq<A> list, Func<int, A, Option<B>> selector)
- rev <T> (Seq<T> list)
- append <T> (Seq<T> lhs, Seq<T> rhs)
- append <T> (Seq<T> x, Seq<Seq<T>> xs)
- append <T> (params Seq<T>[] lists)
- scan <S, T> (Seq<T> list, S state, Func<S, T, S> folder)
- scanBack <S, T> (Seq<T> list, S state, Func<S, T, S> folder)
- zip <T, U, V> (Seq<T> list, Seq<U> other, Func<T, U, V> zipper)
- zip <T, U> (Seq<T> list, Seq<U> other)
- forall <T> (Seq<T> list, Func<T, bool> pred)
- distinct <T> (Seq<T> list)
- distinct <EQ, T> (Seq<T> list)
- distinct <T, K> (Seq<T> list, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = default)
- take <T> (Seq<T> list, int count)
- takeWhile <T> (Seq<T> list, Func<T, bool> pred)
- takeWhile <T> (Seq<T> list, Func<T, int, bool> pred)
- tails <A> (Seq<A> self)
- tailsr <A> (Seq<A> self)
- span <T> (Seq<T> self, Func<T, bool> pred)
- Seq
- Prelude
- map <A, B> (Func<A, B> f, K<Seq, A> ma)
- action <A, B> (K<Seq, A> ma, K<Seq, B> mb)
- apply <A, B> (K<Seq, Func<A, B>> mf, K<Seq, A> ma)
- SeqEmpty
- Enumerator
- SeqLoan <A>
- Rent (ArrayPool<A> pool, int size)
- Rent (int size)
- this []
- Head
- ToSeq ()
- ToReadOnlySpan ()
- ToSpan ()
- Tail
- Init
- IsEmpty
- Last
- Count
- Fold <S> (S state, Func<S, A, S> f)
- FoldBack <S> (S state, Func<S, A, S> f)
- Skip (int amount)
- Take (int amount)
- GetEnumerator ()
- Iter (Action<A> f)
- Exists (Func<A, bool> f)
- ForAll (Func<A, bool> f)
- Append (Seq<A> right)
- Append (SeqLoan<A> right)
- GetHashCode ()
- Dispose ()
Cons sequence 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.
type | A | Type of the values in the sequence |
property Lens<Seq<A>, Option<A>> headOrNone Source #
Head or none lens
property Lens<Seq<A>, Option<A>> lastOrNone Source #
Last or none lens
property Option<A> Head Source #
Head item in the sequence.
If IsEmpty
is true
then Head is undefined and therefore returns None
property bool IsEmpty Source #
Returns true if the sequence is empty
For lazy streams this will have to peek at the first item. So, the first item will be consumed.
Returns the number of items in the sequence
returns | Number of items in the sequence |
property Seq<Seq<A>> Inits Source #
Returns all initial segments of the sequence, shortest first
Including the empty sequence
returns | Initial segments of the sequence |
Seq("a", "b", "c").Inits
> Seq(Seq(), Seq("a"), Seq("a", "b"), Seq("a", "b", "c"))
property Seq<Seq<A>> NonEmptyInits Source #
Returns all initial segments of the sequence, shortest first.
Not including the empty sequence
returns | Initial segments of the sequence |
Seq("a", "b", "c").Inits
> Seq(Seq("a"), Seq("a", "b"), Seq("a", "b", "c"))
property Seq<Seq<A>> Tails Source #
Returns all final segments of the argument, longest first.
Including the empty sequence
returns | Initial segments of the sequence |
Seq("a", "b", "c").Tails
> Seq(Seq("a", "b", "c"), Seq("a", "b"), Seq("a"), Seq())
property Seq<Seq<A>> NonEmptyTails Source #
Returns all final segments of the argument, longest first.
Not including the empty sequence
returns | Initial segments of the sequence |
Seq("a", "b", "c").Tails
> Seq(Seq("a", "b", "c"), Seq("a", "b"), Seq("a"))
property Seq<A> AdditiveIdentity Source #
method void Deconstruct (out A head, out Seq<A> tail) Source #
method Seq<A> Add (A value) Source #
Add an item to the end of the sequence
Forces evaluation of the entire lazy sequence so the item can be appended
method Seq<A> Concat (IEnumerable<A> items) Source #
Add a range of items to the end of the sequence
method Seq<A> Concat (in Lst<A> items) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method Seq<A> Concat (in ReadOnlySpan<A> items) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method Seq<A> Concat (in Set<A> items) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method Seq<A> Concat (in HashSet<A> items) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method Seq<A> Concat (in Arr<A> items) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method Seq<A> Concat (in Stck<A> items) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method Seq<A> Concat (IReadOnlyCollection<A> items) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method Seq<A> Concat (in Seq<A> rhs) Source #
Add a range of items to the end of the sequence
Forces evaluation of the entire lazy sequence so the items can be appended.
method IEnumerable<A> AsEnumerable () Source #
Stream as an enumerable
method Iterable<A> AsIterable () Source #
Stream as an enumerable
method B Match <B> ( Func<B> Empty, Func<A, Seq<A>, B> Tail) Source #
Match empty sequence, or multi-item sequence
type | B | Return value type |
param | Empty | Match for an empty list |
param | Tail | Match for a non-empty |
returns | Result of match function invoked |
method B Match <B> ( Func<B> Empty, Func<A, B> Head, Func<A, Seq<A>, B> Tail) Source #
Match empty sequence, or one item sequence, or multi-item sequence
type | B | Return value type |
param | Empty | Match for an empty list |
param | Tail | Match for a non-empty |
returns | Result of match function invoked |
method B Match <B> ( Func<B> Empty, Func<Seq<A>, B> Seq) Source #
Match empty sequence, or multi-item sequence
type | B | Return value type |
param | Empty | Match for an empty list |
param | Sequence | Match for a non-empty |
returns | Result of match function invoked |
method B Match <B> ( Func<B> Empty, Func<A, B> Head, Func<Seq<A>, B> Tail) Source #
Match empty sequence, or one item sequence, or multi-item sequence
type | B | Return value type |
param | Empty | Match for an empty list |
param | Tail | Match for a non-empty |
returns | Result of match function invoked |
method Seq<A> Do (Action<A> f) Source #
Impure iteration of the bound values in the structure
returns | Returns the original unmodified structure |
method K<F, Seq<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.
type | F | Applicative functor trait |
type | B | Bound value (output) |
param | f | |
param | ta | Traversable structure |
method K<M, Seq<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.
type | M | Monad trait |
type | B | Bound value (output) |
param | f | |
param | ta | Traversable structure |
method Seq<B> Map <B> (Func<A, B> f) Source #
Map the sequence using the function provided
type | B | |
param | f | Mapping function |
returns | Mapped sequence |
method Seq<B> Map <B> (Func<A, int, B> f) Source #
Map the sequence using the function provided
Exposes an index for each map
returns | Mapped sequence |
method Seq<B> Select <B> (Func<A, B> f) Source #
Map the sequence using the function provided
type | B | |
param | f | Mapping function |
returns | Mapped sequence |
method Seq<B> Bind <B> (Func<A, Seq<B>> f) Source #
Monadic bind (flatmap) of the sequence
type | B | Bound return value type |
param | f | Bind function |
returns | Flat-mapped sequence |
method Seq<B> Bind <B> (Func<A, K<Seq, B>> f) Source #
Monadic bind (flatmap) of the sequence
type | B | Bound return value type |
param | f | Bind function |
returns | Flat-mapped sequence |
method Seq<C> SelectMany <B, C> (Func<A, Seq<B>> bind, Func<A, B, C> project) Source #
Monadic bind (flatmap) of the sequence
type | B | Bound return value type |
param | bind | Bind function |
returns | Flat-mapped sequence |
method Seq<A> Filter (Func<A, bool> f) Source #
Filter the items in the sequence
param | f | Predicate to apply to the items |
returns | Filtered sequence |
method Seq<A> Where (Func<A, bool> f) Source #
Filter the items in the sequence
param | f | Predicate to apply to the items |
returns | Filtered sequence |
method bool Exists (Func<A, bool> f) Source #
Returns true if the supplied predicate returns true for any item in the sequence. False otherwise.
param | f | Predicate to apply |
returns | True if the supplied predicate returns true for any item in the sequence. False otherwise. |
method bool ForAll (Func<A, bool> f) Source #
Returns true if the supplied predicate returns true for all items in the sequence. False otherwise. If there is an empty sequence then true is returned.
param | f | Predicate to apply |
returns | True if the supplied predicate returns true for all items in the sequence. False otherwise. If there is an empty sequence then true is returned. |
Returns true if the sequence has items in it
returns | True if the sequence has items in it |
method Seq<A> Intersperse (A value) Source #
Inject a value in between each item in the sequence
type | A | Bound type |
param | ma | Sequence to inject values into |
param | value | Item to inject |
returns | A sequence with the values injected |
method int GetHashCode () Source #
Get the hash code for all of the items in the sequence, or 0 if empty
returns |
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 string ToFullString (string separator = ", ") Source #
Format the collection as a, b, c, ...
method string ToFullArrayString (string separator = ", ") Source #
Format the collection as [a, b, c, ...]
method Seq<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
returns | A new sequence with the first items that match the predicate |
method Seq<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.
returns | A new sequence with the first items that match the predicate |
method (Seq<A> First, Seq<A> Second) Partition (Func<A, bool> predicate) Source #
Partition a list into two based on a predicate
param | predicate | True if the item goes in the first list, false for the second list |
returns | Pair of lists |
method IEnumerator<A> GetEnumerator () Source #
class SeqExtensions Source #
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)).
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.
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)
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)
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
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.
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.
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
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
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
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
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
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'],[]]
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:
type | T | List element type |
param | self | List |
param | pred | Predicate |
returns | Split list |
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
returns |
class SeqExtensions Source #
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.
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.
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.
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.
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |
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.
type | A | Type of the values in the sequence |
method Seq<A> create <A> (params A[] items) Source #
Create a sequence from a initial set of items
param | items | Items |
returns | sequence |
method Seq<A> createRange <A> (ReadOnlySpan<A> items) Source #
Create a sequence from an initial set of items
param | items | Items |
returns | sequence |
method Seq<A> createRange <A> (IEnumerable<A> items) Source #
Create a sequence from an initial set of items
param | items | Items |
returns | sequence |
method Seq<A> generate <A> (int count, Func<int, A> generator) Source #
Generates a sequence of A using the provided delegate to initialise each item.
method Seq<A> repeat <A> (A item, int count) Source #
Generates a sequence that contains one repeated value.
method Option<A> head <A> (Seq<A> list) Source #
Get the item at the head (first) of the sequence
param | list | sequence |
returns | Head item |
method Option<A> last <A> (Seq<A> list) Source #
Get the last item of the sequence
param | list | sequence |
returns | Last item |
method Seq<A> init <A> (Seq<A> list) Source #
Get all items in the list except the last one
Must evaluate the last item to know it's the last, but won't return it
param | list | List |
returns | The initial items (all but the last) |
method Seq<A> tail <A> (Seq<A> list) Source #
Get the tail of the sequence (skips the head item)
param | list | sequence |
returns | Tail sequence |
method Seq<B> map <A, B> (Seq<A> list, Func<A, B> map) Source #
Projects the values in the sequence using a map function into a new sequence (Select in LINQ).
type | A | sequence item type |
type | B | Return sequence item type |
param | list | sequence to map |
param | map | Map function |
returns | Mapped sequence |
method Seq<B> map <A, B> (Seq<A> list, Func<int, A, B> map) Source #
Projects the values in the sequence into a new sequence using a map function, which is also given an index value (Select in LINQ - note that the order of the arguments of the map function are the other way around, here the index is the first argument).
type | A | sequence item type |
type | B | Return sequence item type |
param | list | sequence to map |
param | map | Map function |
returns | Mapped sequence |
method Seq<A> filter <A> (Seq<A> list, Func<A, bool> predicate) Source #
Removes items from the sequence that do not match the given predicate (Where in LINQ)
type | A | sequence item type |
param | list | sequence to filter |
param | predicate | Predicate function |
returns | Filtered sequence |
method Seq<B> choose <A, B> (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)).
type | A | sequence item type |
param | list | sequence |
param | selector | Selector function |
returns | Mapped and filtered sequence |
method Seq<B> choose <A, B> (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.
type | A | sequence item type |
param | list | sequence |
param | selector | Selector function |
returns | Mapped and filtered sequence |
method Seq<T> rev <T> (Seq<T> list) Source #
Reverses the sequence (Reverse in LINQ)
type | T | sequence item type |
param | list | sequence to reverse |
returns | Reversed sequence |
method Seq<T> append <T> (Seq<T> lhs, Seq<T> rhs) Source #
Concatenate two sequences (Concat in LINQ)
type | T | sequence item type |
param | lhs | First sequence |
param | rhs | Second sequence |
returns | Concatenated sequence |
method Seq<T> append <T> (Seq<T> x, Seq<Seq<T>> xs) Source #
Concatenate a sequence and a sequence of sequences
type | T | List item type |
param | lhs | First list |
param | rhs | Second list |
returns | Concatenated list |
method Seq<T> append <T> (params Seq<T>[] lists) Source #
Concatenate N sequences
type | T | sequence type |
param | lists | sequences to concatenate |
returns | A single sequence with all of the items concatenated |
method Seq<S> scan <S, T> (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.
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> (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.
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> (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
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> (Seq<T> list, Seq<U> other) Source #
Joins two sequences together either into an sequence of tuples
param | list | First sequence to join |
param | other | Second sequence to join |
param | zipper | Join function |
returns | Joined sequence of tuples |
method bool forall <T> (Seq<T> list, Func<T, bool> pred) Source #
Returns true if all items in the sequence match a predicate (Any in LINQ)
type | T | sequence item type |
param | list | sequence to test |
param | pred | Predicate |
returns | True if all items in the sequence match the predicate |
method Seq<T> distinct <T> (Seq<T> list) Source #
Return a new sequence with all duplicate values removed
type | T | sequence item type |
param | list | sequence |
returns | A new sequence with all duplicate values removed |
method Seq<T> distinct <EQ, T> (Seq<T> list) Source #
Return a new sequence with all duplicate values removed
type | T | sequence item type |
param | list | sequence |
returns | A new sequence with all duplicate values removed |
method Seq<T> distinct <T, K> (Seq<T> list, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = default) Source #
Return a new sequence with all duplicate values removed
type | T | sequence item type |
param | list | sequence |
returns | A new sequence with all duplicate values removed |
method Seq<T> take <T> (Seq<T> list, int count) Source #
Returns a new sequence with the first 'count' items from the sequence provided
type | T | 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 Seq<T> takeWhile <T> (Seq<T> list, Func<T, bool> pred) Source #
Iterate the sequence, yielding items if they match the predicate provided, and stopping as soon as one doesn't
type | T | 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 Seq<T> takeWhile <T> (Seq<T> list, Func<T, 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.
type | T | 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 Seq<Seq<A>> tails <A> (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'],[]]
type | A | Seq item type |
param | self | Seq |
returns | Seq of Seq of A |
method Seq<Seq<A>> tailsr <A> (Seq<A> self) Source #
The tailsr function returns all final segments of the argument, longest first. For example:
tails(['a','b','c']) == [['a','b','c'], ['b','c'], ['c'],[]]
Differs from tails
in implementation only. The tailsr
uses recursive processing
whereas tails
uses a while loop aggregation followed by a reverse. For small sequences
tailsr
is probably more efficient.
type | A | Seq item type |
param | self | Seq |
returns | Seq of Seq of A |
method (Seq<T>, Seq<T>) span <T> (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:
type | T | List element type |
param | self | List |
param | pred | Predicate |
returns | Split list |
Seq.span(Seq(1,2,3,4,1,2,3,4), x => x 〈 3) == (Seq(1,2), Seq(3,4,1,2,3,4))
Seq.span(Seq(1,2,3), x => x 〈 9) == (Seq(1,2,3), Seq())
Seq.span(Seq(1,2,3), x => x 〈 0) == (Seq(), Seq(1,2,3))
method Seq<B> map <A, B> (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.
param | ma | Functor to map |
param | f | Mapping function |
returns | Mapped functor |
method Seq<B> action <A, B> (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> (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.
param | ma | Value(s) applicative functor |
param | mf | Mapping function(s) |
returns | Mapped applicative functor |
A unit type that represents Seq.Empty
. This type can be implicitly
converted to Seq〈A〉
.
field SeqEmpty Default = new() Source #
Represents a sequence on loan from an ArrayPool
This supports rapid reading of data for use in streaming situations. As soon as any transformations are made the backing data is baked into a Seq of A. This involves cloning the original array (because obviously the rented array will be returned to the pool eventually).
You can manually call Dispose() to release the Array, however it also supports a finaliser to return the backing array back to its pool of origin.
NOTE: If you call Dispose() whilst using this structure on another thread, behaviour is undefined.
type | A | Bound value |
Head item in the sequence. NOTE: If IsEmpty
is true then Head
is undefined. Call HeadOrNone() if for maximum safety.
method ReadOnlySpan<A> ToReadOnlySpan () Source #
method S Fold <S> (S state, Func<S, A, S> f) Source #
Fold the sequence from the first item to the last
type | S | State type |
param | state | Initial state |
param | f | Fold function |
returns | Aggregated state |
method S FoldBack <S> (S state, Func<S, A, S> f) Source #
Fold the sequence from the last item to the first. For sequences that are not lazy and are less than 5000 items long, FoldBackRec is called instead, because it is faster.
type | S | State type |
param | state | Initial state |
param | f | Fold function |
returns | Aggregated state |
method Enumerator GetEnumerator () Source #
method int GetHashCode () Source #