LanguageExt.Core

LanguageExt.Core Immutable Collections Seq

Contents

interface ISeq <A> Source #

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.

struct Seq <A> Source #

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.

Parameters

type A

Type of the values in the sequence

Fields

Indexers

this [ A ] Source #

Indexer

Properties

property object Case Source #

Reference version for use in pattern-matching

property Lens<Seq<A>, A> head Source #

Head lens

property Lens<Seq<A>, Option<A>> headOrNone Source #

Head or none lens

property Lens<Seq<A>, Seq<A>> tail Source #

Tail lens

property Lens<Seq<A>, A> last Source #

Last lens

property Lens<Seq<A>, Option<A>> lastOrNone Source #

Last or none lens

property A Head Source #

Head item in the sequence. NOTE: If IsEmpty is true then Head is undefined. Call HeadOrNone() if for maximum safety.

property Seq<A> Tail Source #

Tail of the sequence

property Seq<A> Init Source #

Get all items except the last one

property A Last Source #

Last item in sequence. Throws if no items in sequence

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.

property int Count Source #

Returns the number of items in the sequence

Parameters

returns

Number of items in the sequence

property int Length Source #

Alias of Count

Parameters

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

Parameters

returns

Initial segments of the sequence

Examples

 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

Parameters

returns

Initial segments of the sequence

Examples

 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

Parameters

returns

Initial segments of the sequence

Examples

 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

Parameters

returns

Initial segments of the sequence

Examples

 Seq("a", "b", "c").Tails

 > Seq(Seq("a", "b", "c"), Seq("a", "b"), Seq("a"))

Constructors

constructor Seq (IEnumerable<A> ma) Source #

Constructor from lazy sequence

Methods

method void Deconstruct (out A head, out Seq<A> tail) Source #

method Lens<Seq<A>, Seq<B>> map <B> (Lens<A, B> lens) Source #

Lens map

method Option<A> At (int index) Source #

Safe indexer

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

Forces evaluation of the entire lazy sequence so the items can be appended.

method Seq<A> Concat (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 (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 (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 (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 (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 (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 Option<A> HeadOrNone () Source #

Head of the sequence if this node isn't the empty node

method Option<A> LastOrNone () Source #

Last item in sequence.

method Either<L, A> LastOrLeft <L> (L Left) Source #

Last item in sequence.

method Either<L, A> LastOrLeft <L> (Func<L> Left) Source #

Last item in sequence.

method Validation<F, A> LastOrInvalid <F> (F Fail) Source #

Last item in sequence.

method Validation<F, A> LastOrInvalid <F> (Func<F> Fail) Source #

Last item in sequence.

method Validation<MonoidFail, F, A> LastOrInvalid <MonoidFail, F> (F Fail) Source #

where MonoidFail : struct, Monoid<F>, Eq<F>

Last item in sequence.

method Validation<MonoidFail, F, A> LastOrInvalid <MonoidFail, F> (Func<F> Fail) Source #

where MonoidFail : struct, Monoid<F>, Eq<F>

Last item in sequence.

method Validation<Fail, A> HeadOrInvalid <Fail> (Fail fail) Source #

Head of the sequence if this node isn't the empty node or fail

Parameters

type Fail
param fail

Fail case

returns

Head of the sequence or fail

method Validation<MonoidFail, Fail, A> HeadOrInvalid <MonoidFail, Fail> (Fail fail) Source #

where MonoidFail : struct, Monoid<Fail>, Eq<Fail>

Head of the sequence

method Either<L, A> HeadOrLeft <L> (L left) Source #

Head of the sequence if this node isn't the empty node or left

Parameters

type L
param left

Left case

returns

Head of the sequence or left

method Either<L, A> HeadOrLeft <L> (Func<L> Left) Source #

Head of the sequence if this node isn't the empty node

method IEnumerable<A> AsEnumerable () 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

Parameters

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

Parameters

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

Parameters

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

Parameters

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

Parameters

returns

Returns the original unmodified structure

method Unit Iter (Action<A> f) Source #

Impure iteration of the bound values in the structure

Parameters

returns

Returns the original unmodified structure

method Seq<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 Seq<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 Seq<B> Bind <B> (Func<A, Seq<B>> f) Source #

Monadic bind (flatmap) of the sequence

Parameters

type B

Bound return value type

param f

Bind function

returns

Flatmapped sequence

method Seq<C> SelectMany <B, C> (Func<A, Seq<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

Flatmapped sequence

method Seq<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 Seq<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 S Fold <S> (S state, Func<S, A, S> f) Source #

Fold the sequence from the first item to the last

Parameters

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.

Parameters

type S

State type

param state

Initial state

param f

Fold function

returns

Aggregated state

method bool Exists (Func<A, bool> f) Source #

Returns true if the supplied predicate returns true for any item in the sequence. False otherwise.

Parameters

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.

Parameters

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.

method bool Any () Source #

Returns true if the sequence has items in it

Parameters

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

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 int GetHashCode () Source #

Get the hash code for all of the items in the sequence, or 0 if empty

Parameters

returns

method int CompareTo (object obj) Source #

method string ToString () Source #

Format the collection as [a, b, c, ...] The elipsis 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 bool Equals (object obj) Source #

Equality test

method bool Equals (ISeq<A> rhs) Source #

Equality test

method bool Equals (Seq<A> rhs) Source #

Equality test

method bool Equals <EqA> (Seq<A> rhs) Source #

where EqA : struct, Eq<A>

Equality test

method Seq<A> Skip (int amount) Source #

Skip count items

method Seq<A> Take (int amount) Source #

Take count items

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

Parameters

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.

Parameters

returns

A new sequence with the first items that match the predicate

method int CompareTo (ISeq<A> rhs) Source #

Compare to another sequence

method int CompareTo <OrdA> (ISeq<A> rhs) Source #

where OrdA : struct, Ord<A>

Compare to another sequence

method int CompareTo (Seq<A> rhs) Source #

Compare to another sequence

method int CompareTo <OrdA> (Seq<A> rhs) Source #

where OrdA : struct, Ord<A>

Compare to another sequence

method Seq<A> Strict () Source #

Force all items lazy to stream

method IEnumerator<A> GetEnumerator () Source #

method Seq<B> Cast <B> () Source #

Operators

operator + (Seq<A> x, Seq<A> y) Source #

Append operator

operator > (Seq<A> x, Seq<A> y) Source #

Ordering operator

operator >= (Seq<A> x, Seq<A> y) Source #

Ordering operator

operator < (Seq<A> x, Seq<A> y) Source #

Ordering operator

operator <= (Seq<A> x, Seq<A> y) Source #

Ordering operator

operator == (Seq<A> x, Seq<A> y) Source #

Equality operator

operator != (Seq<A> x, Seq<A> y) Source #

Non-equality operator

class SeqExtensions Source #

Methods

method Seq<A> Flatten <A> (this Seq<Seq<A>> ma) Source #

Monadic join

method int Count <A> (this ISeq<A> seq) Source #

Get the number of items in the sequence

method int Count <A> (this Seq<A> seq) Source #

Get the number of items in the sequence

method A First <A> (this ISeq<A> seq) Source #

Get the head item in the sequence

method A First <A> (this Seq<A> seq) Source #

Get the head item in the sequence

method A FirstOrDefault <A> (this ISeq<A> seq) Source #

Get the head item in the sequence

method A FirstOrDefault <A> (this Seq<A> seq) Source #

Get the head item in the sequence

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 A Sum <MonoidA, A> (this Seq<A> list) Source #

where MonoidA : struct, Monoid<A>

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method int Sum (this Seq<int> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method float Sum (this Seq<float> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method double Sum (this Seq<double> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method decimal Sum (this Seq<decimal> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

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 S FoldWhile <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence whilst the predicate function returns True for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S FoldWhile <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence, threading an accumulator argument through the computation (and whilst the predicate function returns True when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method S FoldBackWhile <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence (from last element to first) whilst the predicate function returns True for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S FoldBackWhile <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence (from last element to first), threading an accumulator argument through the computation (and whilst the predicate function returns True when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method S FoldUntil <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence whilst the predicate function returns False for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S FoldUntil <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence, threading an accumulator argument through the computation (and whilst the predicate function returns False when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

Enumerable item type

param list

Enumerable to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method S FoldBackUntil <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence (from last element to first) whilst the predicate function returns False for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S FoldBackUntil <S, T> (this Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence (from last element to first), threading an accumulator argument through the computation (and whilst the predicate function returns False when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method T Reduce <T> (this Seq<T> list, Func<T, T, T> reducer) Source #

Applies a function to each element of the sequence, threading an accumulator argument through the computation. This function first applies the function to the first two elements of the sequence. Then, it passes this result into the function along with the third element and so on. Finally, it returns the final result.

Parameters

type T

sequence item type

param list

sequence to reduce

param reducer

Reduce function

returns

Aggregate value

method T ReduceBack <T> (this Seq<T> list, Func<T, T, T> reducer) Source #

Applies a function to each element of the sequence (from last element to first), threading an accumulator argument through the computation. This function first applies the function to the last two elements of the sequence. Then, it passes this result into the function along with the previous element and so on. Finally, it returns the final result.

Parameters

type T

sequence item type

param list

sequence to reduce

param reducer

Reduce function

returns

Aggregate value

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 Option<T> Find <T> (this Seq<T> list, Func<T, bool> pred) Source #

Returns Some(x) for the first item in the sequence that matches the predicate provided, None otherwise.

Parameters

type T

sequence item type

param list

sequence to search

param pred

Predicate

returns

Some(x) for the first item in the sequence that matches the predicate provided, None otherwise.

method Seq<T> FindSeq <T> (this Seq<T> list, Func<T, bool> pred) Source #

Returns [x] for the first item in the sequence that matches the predicate provided, [] otherwise.

Parameters

type T

sequence item type

param list

sequence to search

param pred

Predicate

returns

[x] for the first item in the sequence that matches the predicate provided, [] otherwise.

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 Left, U Right)> 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 Unit Iter <T> (this Seq<T> list, Action<T> action) Source #

Invokes an action for each item in the sequence in order

Parameters

type T

sequence item type

param list

sequence to iterate

param action

Action to invoke with each item

returns

Unit

method Unit Iter <T> (this Seq<T> list, Action<int, T> action) Source #

Invokes an action for each item in the sequence in order and supplies a running index value.

Parameters

type T

sequence item type

param list

sequence to iterate

param action

Action to invoke with each item

returns

Unit

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 #

where EQ : struct, Eq<T>

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(Option<Func<K, K, bool>>)) 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<B> Apply <A, B> (this Seq<Func<A, B>> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions

Parameters

param fabc

sequence of functions

param fa

sequence of argument values

returns

Returns the result of applying the sequence argument values to the sequence functions

method Seq<B> Apply <A, B> (this Func<A, B> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions

Parameters

param fabc

sequence of functions

param fa

sequence of argument values

returns

Returns the result of applying the sequence argument values to the sequence functions

method Seq<Func<B, C>> Apply <A, B, C> (this Seq<Func<A, B, C>> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the IEnumerable of functions: a sequence of functions of arity 1

method Seq<Func<B, C>> Apply <A, B, C> (this Func<A, B, C> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1

method Seq<C> Apply <A, B, C> (this Seq<Func<A, B, C>> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<C> Apply <A, B, C> (this Func<A, B, C> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to an sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<Func<B, C>> Apply <A, B, C> (this Seq<Func<A, Func<B, C>>> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1

method Seq<Func<B, C>> Apply <A, B, C> (this Func<A, Func<B, C>> fabc, Seq<A> fa) Source #

Apply an sequence of values to an sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1

method Seq<C> Apply <A, B, C> (this Seq<Func<A, Func<B, C>>> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to an sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<C> Apply <A, B, C> (this Func<A, Func<B, C>> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<B> Action <A, B> (this Seq<A> fa, Seq<B> fb) Source #

Evaluate fa, then fb, ignoring the result of fa

Parameters

param fa

Applicative to evaluate first

param fb

Applicative to evaluate second and then return

returns

Applicative of type FB derived from Applicative of B

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<Seq<A>> Tailsr <A> (this 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. of the Se

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 TAccumulate Aggregate <TSource, TAccumulate> (this Seq<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func) Source #

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value.

method TResult Aggregate <TSource, TAccumulate, TResult> (this Seq<TSource> source, TAccumulate seed, Func<TAccumulate, TSource, TAccumulate> func, Func<TAccumulate, TResult> resultSelector) Source #

Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.

method TSource Aggregate <TSource> (this Seq<TSource> source, Func<TSource, TSource, TSource> func) Source #

Applies an accumulator function over a sequence.

method bool All <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Determines whether all elements of a sequence satisfy a condition.

method bool Any <TSource> (this Seq<TSource> source) Source #

Determines whether a sequence contains any elements.

method bool Any <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Determines whether any element of a sequence satisfies a condition.

method IEnumerable<TSource> AsEnumerable <TSource> (this Seq<TSource> source) Source #

Returns the input typed as IEnumerable.

method IQueryable<TElement> AsQueryable <TElement> (this Seq<TElement> source) Source #

Converts a generic IEnumerable to a generic IQueryable.

method decimal Average (this Seq<decimal> source) Source #

Computes the average of a sequence of Decimal values.

method decimal Average <TSource> (this Seq<TSource> source, Func<TSource, decimal> selector) Source #

Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.

method decimal? Average (this Seq<decimal?> source) Source #

Computes the average of a sequence of nullable Decimal values.

method decimal? Average <TSource> (this Seq<TSource> source, Func<TSource, decimal?> selector) Source #

Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.

method double Average (this Seq<double> source) Source #

Computes the average of a sequence of Double values.

method double Average (this Seq<int> source) Source #

Computes the average of a sequence of Int32 values.

method double Average (this Seq<long> source) Source #

Computes the average of a sequence of Int64 values.

method double Average <TSource> (this Seq<TSource> source, Func<TSource, double> selector) Source #

Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

method double Average <TSource> (this Seq<TSource> source, Func<TSource, int> selector) Source #

Computes the average of a sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence.

method double Average <TSource> (this Seq<TSource> source, Func<TSource, long> selector) Source #

Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

method double? Average (this Seq<double?> source) Source #

Computes the average of a sequence of nullable Double values.

method double? Average (this Seq<int?> source) Source #

Computes the average of a sequence of nullable Int32 values.

method double? Average (this Seq<long?> source) Source #

Computes the average of a sequence of nullable Int64 values.

method double? Average <TSource> (this Seq<TSource> source, Func<TSource, double?> selector) Source #

Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.

method double? Average <TSource> (this Seq<TSource> source, Func<TSource, int?> selector) Source #

Computes the average of a sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence.

method double? Average <TSource> (this Seq<TSource> source, Func<TSource, long?> selector) Source #

Computes the average of a sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence.

method float Average (this Seq<float> source) Source #

Computes the average of a sequence of Single values.

method float Average <TSource> (this Seq<TSource> source, Func<TSource, float> selector) Source #

Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

method float? Average (this Seq<float?> source) Source #

Computes the average of a sequence of nullable Single values.

method float? Average <TSource> (this Seq<TSource> source, Func<TSource, float?> selector) Source #

Computes the average of a sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence.

method IEnumerable<TSource> Concat <TSource> (this Seq<TSource> first, IEnumerable<TSource> second) Source #

Concatenates two sequences.

method bool Contains <TSource> (this Seq<TSource> source, TSource value) Source #

Determines whether a sequence contains a specified element by using the default equality comparer.

method bool Contains <TSource> (this Seq<TSource> source, TSource value, IEqualityComparer<TSource> comparer) Source #

Determines whether a sequence contains a specified element by using a specified IEqualityComparer.

method int Count <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns a number that represents how many elements in the specified sequence satisfy a condition.

method IEnumerable<TSource> DefaultIfEmpty <TSource> (this Seq<TSource> source) Source #

Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.

method IEnumerable<TSource> DefaultIfEmpty <TSource> (this Seq<TSource> source, TSource defaultValue) Source #

Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty.

method IEnumerable<TSource> Distinct <TSource> (this Seq<TSource> source, IEqualityComparer<TSource> comparer) Source #

Returns distinct elements from a sequence by using a specified IEqualityComparer to compare values.

method TSource ElementAt <TSource> (this Seq<TSource> source, int index) Source #

Returns the element at a specified index in a sequence.

method TSource ElementAtOrDefault <TSource> (this Seq<TSource> source, int index) Source #

Returns the element at a specified index in a sequence or a default value if the index is out of range.

method IEnumerable<TSource> Except <TSource> (this Seq<TSource> first, IEnumerable<TSource> second) Source #

Produces the set difference of two sequences by using the default equality comparer to compare values.

method IEnumerable<TSource> Except <TSource> (this Seq<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) Source #

Produces the set difference of two sequences by using the specified IEqualityComparer to compare values.

method TSource First <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns the first element in a sequence that satisfies a specified condition.

method TSource FirstOrDefault <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

method IEnumerable<IGrouping<TKey, TElement>> GroupBy <TSource, TKey, TElement> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) Source #

Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function.

method IEnumerable<IGrouping<TKey, TElement>> GroupBy <TSource, TKey, TElement> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) Source #

Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function.

method IEnumerable<IGrouping<TKey, TSource>> GroupBy <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector) Source #

Groups the elements of a sequence according to a specified key selector function.

method IEnumerable<IGrouping<TKey, TSource>> GroupBy <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer) Source #

Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer.

method IEnumerable<TResult> GroupBy <TSource, TKey, TElement, TResult> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector) Source #

Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function.

method IEnumerable<TResult> GroupBy <TSource, TKey, TElement, TResult> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<TKey, IEnumerable<TElement>, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #

Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function.

method IEnumerable<TResult> GroupBy <TSource, TKey, TResult> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector) Source #

Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key.

method IEnumerable<TResult> GroupBy <TSource, TKey, TResult> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TKey, IEnumerable<TSource>, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #

Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer.

method IEnumerable<TResult> GroupJoin <TOuter, TInner, TKey, TResult> (this Seq<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector) Source #

Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.

method IEnumerable<TResult> GroupJoin <TOuter, TInner, TKey, TResult> (this Seq<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, IEnumerable<TInner>, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #

Correlates the elements of two sequences based on key equality and groups the results. A specified IEqualityComparer is used to compare keys.

method IEnumerable<TSource> Intersect <TSource> (this Seq<TSource> first, IEnumerable<TSource> second) Source #

Produces the set intersection of two sequences by using the default equality comparer to compare values.

method IEnumerable<TSource> Intersect <TSource> (this Seq<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) Source #

Produces the set intersection of two sequences by using the specified IEqualityComparer to compare values.

method IEnumerable<TResult> Join <TOuter, TInner, TKey, TResult> (this Seq<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector) Source #

Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.

method IEnumerable<TResult> Join <TOuter, TInner, TKey, TResult> (this Seq<TOuter> outer, IEnumerable<TInner> inner, Func<TOuter, TKey> outerKeySelector, Func<TInner, TKey> innerKeySelector, Func<TOuter, TInner, TResult> resultSelector, IEqualityComparer<TKey> comparer) Source #

Correlates the elements of two sequences based on matching keys. A specified IEqualityComparer is used to compare keys.

method TSource Last <TSource> (this Seq<TSource> source) Source #

Returns the last element of a sequence.

method TSource Last <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns the last element of a sequence that satisfies a specified condition.

method TSource LastOrDefault <TSource> (this Seq<TSource> source) Source #

Returns the last element of a sequence, or a default value if the sequence contains no elements.

method TSource LastOrDefault <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.

method long LongCount <TSource> (this Seq<TSource> source) Source #

Returns an Int64 that represents the total number of elements in a sequence.

method long LongCount <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns an Int64 that represents how many elements in a sequence satisfy a condition.

method decimal Max (this Seq<decimal> source) Source #

Returns the maximum value in a sequence of Decimal values.

method decimal Max <TSource> (this Seq<TSource> source, Func<TSource, decimal> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum Decimal value.

method decimal? Max (this Seq<decimal?> source) Source #

Returns the maximum value in a sequence of nullable Decimal values.

method decimal? Max <TSource> (this Seq<TSource> source, Func<TSource, decimal?> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value.

method double Max (this Seq<double> source) Source #

Returns the maximum value in a sequence of Double values.

method double Max <TSource> (this Seq<TSource> source, Func<TSource, double> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum Double value.

method double? Max (this Seq<double?> source) Source #

Returns the maximum value in a sequence of nullable Double values.

method double? Max <TSource> (this Seq<TSource> source, Func<TSource, double?> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum nullable Double value.

method float Max (this Seq<float> source) Source #

Returns the maximum value in a sequence of Single values.

method float Max <TSource> (this Seq<TSource> source, Func<TSource, float> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum Single value.

method float? Max (this Seq<float?> source) Source #

Returns the maximum value in a sequence of nullable Single values.

method float? Max <TSource> (this Seq<TSource> source, Func<TSource, float?> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum nullable Single value.

method int Max (this Seq<int> source) Source #

Returns the maximum value in a sequence of Int32 values.

method int Max <TSource> (this Seq<TSource> source, Func<TSource, int> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum Int32 value.

method int? Max (this Seq<int?> source) Source #

Returns the maximum value in a sequence of nullable Int32 values.

method int? Max <TSource> (this Seq<TSource> source, Func<TSource, int?> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum nullable Int32 value.

method long Max (this Seq<long> source) Source #

Returns the maximum value in a sequence of Int64 values.

method long Max <TSource> (this Seq<TSource> source, Func<TSource, long> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum Int64 value.

method long? Max (this Seq<long?> source) Source #

Returns the maximum value in a sequence of nullable Int64 values.

method long? Max <TSource> (this Seq<TSource> source, Func<TSource, long?> selector) Source #

Invokes a transform function on each element of a sequence and returns the maximum nullable Int64 value.

method TResult Max <TSource, TResult> (this Seq<TSource> source, Func<TSource, TResult> selector) Source #

Invokes a transform function on each element of a generic sequence and returns the maximum resulting value.

method TSource Max <TSource> (this Seq<TSource> source) Source #

Returns the maximum value in a generic sequence.

method decimal Min (this Seq<decimal> source) Source #

Returns the minimum value in a sequence of Decimal values.

method decimal Min <TSource> (this Seq<TSource> source, Func<TSource, decimal> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum Decimal value.

method decimal? Min (this Seq<decimal?> source) Source #

Returns the minimum value in a sequence of nullable Decimal values.

method decimal? Min <TSource> (this Seq<TSource> source, Func<TSource, decimal?> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value.

method double Min (this Seq<double> source) Source #

Returns the minimum value in a sequence of Double values.

method double Min <TSource> (this Seq<TSource> source, Func<TSource, double> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum Double value.

method double? Min (this Seq<double?> source) Source #

Returns the minimum value in a sequence of nullable Double values.

method double? Min <TSource> (this Seq<TSource> source, Func<TSource, double?> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum nullable Double value.

method float Min (this Seq<float> source) Source #

Returns the minimum value in a sequence of Single values.

method float Min <TSource> (this Seq<TSource> source, Func<TSource, float> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum Single value.

method float? Min (this Seq<float?> source) Source #

Returns the minimum value in a sequence of nullable Single values.

method float? Min <TSource> (this Seq<TSource> source, Func<TSource, float?> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum nullable Single value.

method int Min (this Seq<int> source) Source #

Returns the minimum value in a sequence of Int32 values.

method int Min <TSource> (this Seq<TSource> source, Func<TSource, int> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum Int32 value.

method int? Min (this Seq<int?> source) Source #

Returns the minimum value in a sequence of nullable Int32 values.

method int? Min <TSource> (this Seq<TSource> source, Func<TSource, int?> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum nullable Int32 value.

method long Min (this Seq<long> source) Source #

Returns the minimum value in a sequence of Int64 values.

method long Min <TSource> (this Seq<TSource> source, Func<TSource, long> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum Int64 value.

method long? Min (this Seq<long?> source) Source #

Returns the minimum value in a sequence of nullable Int64 values.

method long? Min <TSource> (this Seq<TSource> source, Func<TSource, long?> selector) Source #

Invokes a transform function on each element of a sequence and returns the minimum nullable Int64 value.

method TResult Min <TSource, TResult> (this Seq<TSource> source, Func<TSource, TResult> selector) Source #

Invokes a transform function on each element of a generic sequence and returns the minimum resulting value.

method TSource Min <TSource> (this Seq<TSource> source) Source #

Returns the minimum value in a generic sequence.

method IOrderedEnumerable<TSource> OrderBy <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector) Source #

Sorts the elements of a sequence in ascending order according to a key.

method IOrderedEnumerable<TSource> OrderBy <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer) Source #

Sorts the elements of a sequence in ascending order by using a specified comparer.

method IOrderedEnumerable<TSource> OrderByDescending <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector) Source #

Sorts the elements of a sequence in descending order according to a key.

method IOrderedEnumerable<TSource> OrderByDescending <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer) Source #

Sorts the elements of a sequence in descending order by using a specified comparer.

method IEnumerable<TSource> Reverse <TSource> (this Seq<TSource> source) Source #

Inverts the order of the elements in a sequence.

method bool SequenceEqual <TSource> (this Seq<TSource> first, IEnumerable<TSource> second) Source #

Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.

method bool SequenceEqual <TSource> (this Seq<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) Source #

Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparer.

method TSource Single <TSource> (this Seq<TSource> source) Source #

Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

method TSource Single <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

method TSource SingleOrDefault <TSource> (this Seq<TSource> source) Source #

Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

method TSource SingleOrDefault <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.

method IEnumerable<TSource> Skip <TSource> (this Seq<TSource> source, int count) Source #

Bypasses a specified number of elements in a sequence and then returns the remaining elements.

method IEnumerable<TSource> SkipWhile <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.

method IEnumerable<TSource> SkipWhile <TSource> (this Seq<TSource> source, Func<TSource, int, bool> predicate) Source #

Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function.

method decimal Sum <TSource> (this Seq<TSource> source, Func<TSource, decimal> selector) Source #

Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence.

method decimal? Sum (this Seq<decimal?> source) Source #

Computes the sum of a sequence of nullable Decimal values.

method decimal? Sum <TSource> (this Seq<TSource> source, Func<TSource, decimal?> selector) Source #

Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence.

method double Sum <TSource> (this Seq<TSource> source, Func<TSource, double> selector) Source #

Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

method double? Sum (this Seq<double?> source) Source #

Computes the sum of a sequence of nullable Double values.

method double? Sum <TSource> (this Seq<TSource> source, Func<TSource, double?> selector) Source #

Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence.

method float Sum <TSource> (this Seq<TSource> source, Func<TSource, float> selector) Source #

Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

method float? Sum (this Seq<float?> source) Source #

Computes the sum of a sequence of nullable Single values.

method float? Sum <TSource> (this Seq<TSource> source, Func<TSource, float?> selector) Source #

Computes the sum of the sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence.

method int Sum <TSource> (this Seq<TSource> source, Func<TSource, int> selector) Source #

Computes the sum of the sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence.

method int? Sum (this Seq<int?> source) Source #

Computes the sum of a sequence of nullable Int32 values.

method int? Sum <TSource> (this Seq<TSource> source, Func<TSource, int?> selector) Source #

Computes the sum of the sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence.

method long Sum (this Seq<long> source) Source #

Computes the sum of a sequence of Int64 values.

method long Sum <TSource> (this Seq<TSource> source, Func<TSource, long> selector) Source #

Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

method long? Sum (this Seq<long?> source) Source #

Computes the sum of a sequence of nullable Int64 values.

method long? Sum <TSource> (this Seq<TSource> source, Func<TSource, long?> selector) Source #

Computes the sum of the sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence.

method IEnumerable<TSource> Take <TSource> (this Seq<TSource> source, int count) Source #

Returns a specified number of contiguous elements from the start of a sequence.

method IEnumerable<TSource> TakeWhile <TSource> (this Seq<TSource> source, Func<TSource, bool> predicate) Source #

Returns elements from a sequence as long as a specified condition is true.

method IEnumerable<TSource> TakeWhile <TSource> (this Seq<TSource> source, Func<TSource, int, bool> predicate) Source #

Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.

method TSource[] ToArray <TSource> (this Seq<TSource> source) Source #

Creates an array from a IEnumerable.

method Dictionary<TKey, TElement> ToDictionary <TSource, TKey, TElement> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) Source #

Creates a Dictionary<TKey,TValue> from an IEnumerable according to specified key selector and element selector functions.

method Dictionary<TKey, TElement> ToDictionary <TSource, TKey, TElement> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) Source #

Creates a Dictionary<TKey,TValue> from an IEnumerable according to a specified key selector function, a comparer, and an element selector function.

method Dictionary<TKey, TSource> ToDictionary <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector) Source #

Creates a Dictionary<TKey,TValue> from an IEnumerable according to a specified key selector function.

method Dictionary<TKey, TSource> ToDictionary <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer) Source #

Creates a Dictionary<TKey,TValue> from an IEnumerable according to a specified key selector function and key comparer.

method List<TSource> ToList <TSource> (this Seq<TSource> source) Source #

Creates a List from an IEnumerable.

method ILookup<TKey, TElement> ToLookup <TSource, TKey, TElement> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector) Source #

Creates a Lookup<TKey,TElement> from an IEnumerable according to specified key selector and element selector functions.

method ILookup<TKey, TElement> ToLookup <TSource, TKey, TElement> (this Seq<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) Source #

Creates a Lookup<TKey,TElement> from an IEnumerable according to a specified key selector function, a comparer and an element selector function.

method ILookup<TKey, TSource> ToLookup <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector) Source #

Creates a Lookup<TKey,TElement> from an IEnumerable according to a specified key selector function.

method ILookup<TKey, TSource> ToLookup <TSource, TKey> (this Seq<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey> comparer) Source #

Creates a Lookup<TKey,TElement> from an IEnumerable according to a specified key selector function and key comparer.

method IEnumerable<TSource> Union <TSource> (this Seq<TSource> first, IEnumerable<TSource> second) Source #

Produces the set union of two sequences by using the default equality comparer.

method IEnumerable<TSource> Union <TSource> (this Seq<TSource> first, IEnumerable<TSource> second, IEqualityComparer<TSource> comparer) Source #

Produces the set union of two sequences by using a specified IEqualityComparer.

method IEnumerable<TResult> Zip <TFirst, TSecond, TResult> (this Seq<TFirst> first, IEnumerable<TSecond> second, Func<TFirst, TSecond, TResult> resultSelector) Source #

Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.

class Seq Source #

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 Seq<A> flatten <A> (Seq<Seq<A>> ma) Source #

Monadic join

method Seq<A> empty <A> () Source #

Create an empty sequence

method Seq<A> create <A> () Source #

Create a new empty sequence

Parameters

returns

sequence

method Seq<A> create <A> (params A[] items) Source #

Create a sequence from a initial set of items

Parameters

param items

Items

returns

sequence

method Seq<A> createRange <A> (IEnumerable<A> items) Source #

Create a sequence from an initial set of items

Parameters

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 A head <A> (Seq<A> list) Source #

Get the item at the head (first) of the sequence

Parameters

param list

sequence

returns

Head item

method Option<A> headOrNone <A> (Seq<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 Validation<Fail, A> headOrInvalid <Fail, A> (Seq<A> list, Fail fail) Source #

Get the item at the head (first) of the sequence or Fail if the sequence is empty

Parameters

param list

sequence

param fail

Fail case

returns

Validated head item

method Validation<MonoidFail, Fail, A> headOrInvalid <MonoidFail, Fail, A> (Seq<A> list, Fail fail) Source #

where MonoidFail : struct, Monoid<Fail>, Eq<Fail>

Get the item at the head (first) of the sequence or Fail if the sequence is empty

Parameters

param list

sequence

param fail

Fail case

returns

Validated head item

method Either<L, A> headOrLeft <L, A> (Seq<A> list, L left) Source #

Get the item at the head (first) of the sequence or Left if the sequence is empty

Parameters

param list

sequence

param left

Left case

returns

Either head item or left

method A last <A> (Seq<A> list) Source #

Get the last item of the sequence

Parameters

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

Parameters

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)

Parameters

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).

Parameters

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 sequnce 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).

Parameters

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)

Parameters

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)).

Parameters

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.

Parameters

type A

sequence item type

param list

sequence

param selector

Selector function

returns

Mapped and filtered sequence

method A sum <MonoidA, A> (Seq<A> list) Source #

where MonoidA : struct, Monoid<A>

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method int sum (Seq<int> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method float sum (Seq<float> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method double sum (Seq<double> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method decimal sum (Seq<decimal> list) Source #

Returns the sum total of all the items in the list (Sum in LINQ)

Parameters

param list

List to sum

returns

Sum total

method Seq<T> rev <T> (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> (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> (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<T> append <T> (params Seq<T>[] lists) Source #

Concatenate N sequences

Parameters

type T

sequence type

param lists

sequences to concatenate

returns

A single sequence with all of the items concatenated

method S fold <S, T> (Seq<T> list, S state, Func<S, T, S> folder) Source #

Applies a function 'folder' to each element of the sequence, threading an accumulator argument through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result. (Aggregate in LINQ)

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

returns

Aggregate value

method S foldBack <S, T> (Seq<T> list, S state, Func<S, T, S> folder) Source #

Applies a function 'folder' to each element of the sequence (from last element to first), threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

returns

Aggregate value

method S foldWhile <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence whilst the predicate function returns True for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S foldWhile <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence, threading an accumulator argument through the computation (and whilst the predicate function returns True when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method S foldBackWhile <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence (from last element to first) whilst the predicate function returns True for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S foldBackWhile <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence (from last element to first), threading an accumulator argument through the computation (and whilst the predicate function returns True when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method S foldUntil <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence whilst the predicate function returns False for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S foldUntil <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence, threading an accumulator argument through the computation (and whilst the predicate function returns False when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

Enumerable item type

param list

Enumerable to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method S foldBackUntil <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> preditem) Source #

Applies a function 'folder' to each element of the sequence (from last element to first) whilst the predicate function returns False for the item being processed, threading an aggregate state through the computation. The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param preditem

Predicate function

returns

Aggregate value

method S foldBackUntil <S, T> (Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> predstate) Source #

Applies a function 'folder' to each element of the sequence (from last element to first), threading an accumulator argument through the computation (and whilst the predicate function returns False when passed the aggregate state). The fold function takes the state argument, and applies the function 'folder' to it and the first element of the sequence. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

Parameters

type S

State type

type T

sequence item type

param list

sequence to fold

param state

Initial state

param folder

Fold function

param predstate

Predicate function

returns

Aggregate value

method T reduce <T> (Seq<T> list, Func<T, T, T> reducer) Source #

Applies a function to each element of the sequence (from last element to first), threading an accumulator argument through the computation. This function first applies the function to the first two elements of the sequence. Then, it passes this result into the function along with the third element and so on. Finally, it returns the final result.

Parameters

type T

sequence item type

param list

sequence to reduce

param reducer

Reduce function

returns

Aggregate value

method T reduceBack <T> (Seq<T> list, Func<T, T, T> reducer) Source #

Applies a function to each element of the sequence, threading an accumulator argument through the computation. This function first applies the function to the first two elements of the sequence. Then, it passes this result into the function along with the third element and so on. Finally, it returns the final result.

Parameters

type T

sequence item type

param list

sequence to reduce

param reducer

Reduce function

returns

Aggregate value

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.

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> (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 Option<T> find <T> (Seq<T> list, Func<T, bool> pred) Source #

Returns Some(x) for the first item in the sequence that matches the predicate provided, None otherwise.

Parameters

type T

sequence item type

param list

sequence to search

param pred

Predicate

returns

Some(x) for the first item in the sequence that matches the predicate provided, None otherwise.

method Seq<T> findSeq <T> (Seq<T> list, Func<T, bool> pred) Source #

Returns [x] for the first item in the sequence that matches the predicate provided, [] otherwise.

Parameters

type T

sequence item type

param list

sequence to search

param pred

Predicate

returns

[x] for the first item in the sequence that matches the predicate provided, [] otherwise.

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

Parameters

param list

First sequence to join

param other

Second sequence to join

param zipper

Join function

returns

Joined sequence

method Seq<(T Left, U Right)> zip <T, U> (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 int length <T> (Seq<T> list) Source #

Returns the number of items in the sequence

Parameters

type T

sequence item type

param list

sequence to count

returns

The number of items in the sequence

method Unit iter <T> (Seq<T> list, Action<T> action) Source #

Invokes an action for each item in the sequence in order

Parameters

type T

sequence item type

param list

sequence to iterate

param action

Action to invoke with each item

returns

Unit

method Unit iter <T> (Seq<T> list, Action<int, T> action) Source #

Invokes an action for each item in the sequence in order and supplies a running index value.

Parameters

type T

sequence item type

param list

sequence to iterate

param action

Action to invoke with each item

returns

Unit

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)

Parameters

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

Parameters

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 #

where EQ : struct, Eq<T>

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> (Seq<T> list, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = default(Option<Func<K, K, bool>>)) 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> take <T> (Seq<T> list, int count) Source #

Returns a new sequence with the first 'count' items from the sequence provided

Parameters

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

Parameters

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.

Parameters

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 bool exists <T> (Seq<T> list, Func<T, bool> pred) Source #

Returns true if any item in the sequence matches the predicate provided

Parameters

type T

sequence item type

param list

sequence to test

param pred

Predicate

returns

True if any item in the sequence matches the predicate provided

method Seq<B> apply <A, B> (Seq<Func<A, B>> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions

Parameters

param fabc

sequence of functions

param fa

sequence of argument values

returns

Returns the result of applying the sequence argument values to the sequence functions

method Seq<B> apply <A, B> (Func<A, B> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions

Parameters

param fabc

sequence of functions

param fa

sequence of argument values

returns

Returns the result of applying the sequence argument values to the sequence functions

method Seq<Func<B, C>> apply <A, B, C> (Seq<Func<A, B, C>> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the IEnumerable of functions: a sequence of functions of arity 1

method Seq<Func<B, C>> apply <A, B, C> (Func<A, B, C> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1

method Seq<C> apply <A, B, C> (Seq<Func<A, B, C>> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<C> apply <A, B, C> (Func<A, B, C> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to an sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<Func<B, C>> apply <A, B, C> (Seq<Func<A, Func<B, C>>> fabc, Seq<A> fa) Source #

Apply a sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1

method Seq<Func<B, C>> apply <A, B, C> (Func<A, Func<B, C>> fabc, Seq<A> fa) Source #

Apply an sequence of values to an sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

returns

Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1

method Seq<C> apply <A, B, C> (Seq<Func<A, Func<B, C>>> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to an sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<C> apply <A, B, C> (Func<A, Func<B, C>> fabc, Seq<A> fa, Seq<B> fb) Source #

Apply sequence of values to a sequence of functions of arity 2

Parameters

param fabc

sequence of functions

param fa

sequence argument values

param fb

sequence argument values

returns

Returns the result of applying the sequence of arguments to the sequence of functions

method Seq<B> action <A, B> (Seq<A> fa, Seq<B> fb) Source #

Evaluate fa, then fb, ignoring the result of fa

Parameters

param fa

Applicative to evaluate first

param fb

Applicative to evaluate second and then return

returns

Applicative of type FB derived from Applicative of B

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'],[]]

Parameters

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.

Parameters

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:

Parameters

type T

List element type

param self

List

param pred

Predicate

returns

Split list

Examples

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))

struct SeqEmpty Source #

A unit type that represents Seq.Empty. This type can be implicitly converted to Seq<A>.

Fields

struct Enumerator Source #

Properties

property ref A Current Source #

Methods

method bool MoveNext () Source #

class SeqLoan <A> 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.

Parameters

type A

Bound value

Indexers

this [ A ] Source #

Indexer

Properties

property A Head Source #

Head item in the sequence. NOTE: If IsEmpty is true then Head is undefined. Call HeadOrNone() if for maximum safety.

property Seq<A> Tail Source #

Tail of the sequence

property Seq<A> Init Source #

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.

property A Last Source #

Last item in sequence. Throws if no items in sequence

property int Count Source #

Returns the number of items in the sequence

Parameters

returns

Number of items in the sequence

Methods

method SeqLoan<A> Rent (ArrayPool<A> pool, int size) Source #

Create a newly rented array

method SeqLoan<A> Rent (int size) Source #

Create a newly rented array

method Seq<A> ToSeq () Source #

Clone to a Seq

method ReadOnlySpan<A> ToReadOnlySpan () Source #

method Span<A> ToSpan () Source #

method S Fold <S> (S state, Func<S, A, S> f) Source #

Fold the sequence from the first item to the last

Parameters

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.

Parameters

type S

State type

param state

Initial state

param f

Fold function

returns

Aggregated state

method Seq<A> Skip (int amount) Source #

Skip count items

method Seq<A> Take (int amount) Source #

Take count items

method Enumerator GetEnumerator () Source #

method Unit Iter (Action<A> f) Source #

method bool Exists (Func<A, bool> f) Source #

method bool ForAll (Func<A, bool> f) Source #

method Seq<A> Append (Seq<A> right) Source #

method Seq<A> Append (SeqLoan<A> right) Source #

method int GetHashCode () Source #

method void Dispose () Source #