Seq Class

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.

DECLARATION
public static class Seq
NAMESPACE
LanguageExt

Methods

action<A, B>(Seq<A>, Seq<B>)
SUMMARY

Evaluate fa, then fb, ignoring the result of fa

PARAMETERS
fa
Seq<A>
Applicative to evaluate first
fb
Seq<B>
Applicative to evaluate second and then return
DECLARATION
[Pure]
public static Seq<B> action<A, B>(Seq<A> fa, Seq<B> fb)
RETURNS
Seq<B>
Applicative of type FB derived from Applicative of B
append<T>(Seq<T>, Seq<T>)
SUMMARY

Concatenate two sequences (Concat in LINQ)

PARAMETERS
lhs
Seq<T>
First sequence
rhs
Seq<T>
Second sequence
DECLARATION
[Pure]
public static Seq<T> append<T>(Seq<T> lhs, Seq<T> rhs)
RETURNS
Seq<T>
Concatenated sequence
append<T>(Seq<T>, Seq<Seq<T>>)
SUMMARY

Concatenate a sequence and a sequence of sequences

PARAMETERS
x
Seq<T>
xs
Seq<Seq<T>>
DECLARATION
[Pure]
public static Seq<T> append<T>(Seq<T> x, Seq<Seq<T>> xs)
RETURNS
Seq<T>
Concatenated list
append<T>(Seq<T>)
SUMMARY

Concatenate N sequences

PARAMETERS
lists
Seq<T>
sequences to concatenate
DECLARATION
[Pure]
public static Seq<T> append<T>(Seq<T> lists)
RETURNS
Seq<T>
A single sequence with all of the items concatenated
apply<A, B, C>(Seq<Func<A, B, C>>, Seq<A>)
SUMMARY

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

PARAMETERS
fabc
Seq<Func<A, B, C>>
sequence of functions
fa
Seq<A>
sequence argument values
DECLARATION
[Pure]
public static Seq<Func<B, C>> apply<A, B, C>(Seq<Func<A, B, C>> fabc, Seq<A> fa)
RETURNS
Seq<Func<B, C>>
Returns the result of applying the sequence of argument values to the IEnumerable of functions: a sequence of functions of arity 1
apply<A, B, C>(Func<A, B, C>, Seq<A>)
SUMMARY

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

PARAMETERS
fabc
Func<A, B, C>
sequence of functions
fa
Seq<A>
sequence argument values
DECLARATION
[Pure]
public static Seq<Func<B, C>> apply<A, B, C>(Func<A, B, C> fabc, Seq<A> fa)
RETURNS
Seq<Func<B, C>>
Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1
apply<A, B, C>(Seq<Func<A, B, C>>, Seq<A>, Seq<B>)
SUMMARY

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

PARAMETERS
fabc
Seq<Func<A, B, C>>
sequence of functions
fa
Seq<A>
sequence argument values
fb
Seq<B>
sequence argument values
DECLARATION
[Pure]
public static Seq<C> apply<A, B, C>(Seq<Func<A, B, C>> fabc, Seq<A> fa, Seq<B> fb)
RETURNS
Seq<C>
Returns the result of applying the sequence of arguments to the sequence of functions
apply<A, B, C>(Func<A, B, C>, Seq<A>, Seq<B>)
SUMMARY

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

PARAMETERS
fabc
Func<A, B, C>
sequence of functions
fa
Seq<A>
sequence argument values
fb
Seq<B>
sequence argument values
DECLARATION
[Pure]
public static Seq<C> apply<A, B, C>(Func<A, B, C> fabc, Seq<A> fa, Seq<B> fb)
RETURNS
Seq<C>
Returns the result of applying the sequence of arguments to the sequence of functions
apply<A, B, C>(Seq<Func<A, Func<B, C>>>, Seq<A>)
SUMMARY

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

PARAMETERS
fabc
Seq<Func<A, Func<B, C>>>
sequence of functions
fa
Seq<A>
sequence argument values
DECLARATION
[Pure]
public static Seq<Func<B, C>> apply<A, B, C>(Seq<Func<A, Func<B, C>>> fabc, Seq<A> fa)
RETURNS
Seq<Func<B, C>>
Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1
apply<A, B, C>(Func<A, Func<B, C>>, Seq<A>)
SUMMARY

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

PARAMETERS
fabc
Func<A, Func<B, C>>
sequence of functions
fa
Seq<A>
sequence argument values
DECLARATION
[Pure]
public static Seq<Func<B, C>> apply<A, B, C>(Func<A, Func<B, C>> fabc, Seq<A> fa)
RETURNS
Seq<Func<B, C>>
Returns the result of applying the sequence of argument values to the sequence of functions: a sequence of functions of arity 1
apply<A, B, C>(Seq<Func<A, Func<B, C>>>, Seq<A>, Seq<B>)
SUMMARY

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

PARAMETERS
fabc
Seq<Func<A, Func<B, C>>>
sequence of functions
fa
Seq<A>
sequence argument values
fb
Seq<B>
sequence argument values
DECLARATION
[Pure]
public static Seq<C> apply<A, B, C>(Seq<Func<A, Func<B, C>>> fabc, Seq<A> fa, Seq<B> fb)
RETURNS
Seq<C>
Returns the result of applying the sequence of arguments to the sequence of functions
apply<A, B, C>(Func<A, Func<B, C>>, Seq<A>, Seq<B>)
SUMMARY

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

PARAMETERS
fabc
Func<A, Func<B, C>>
sequence of functions
fa
Seq<A>
sequence argument values
fb
Seq<B>
sequence argument values
DECLARATION
[Pure]
public static Seq<C> apply<A, B, C>(Func<A, Func<B, C>> fabc, Seq<A> fa, Seq<B> fb)
RETURNS
Seq<C>
Returns the result of applying the sequence of arguments to the sequence of functions
apply<A, B>(Seq<Func<A, B>>, Seq<A>)
SUMMARY

Apply a sequence of values to a sequence of functions

PARAMETERS
fabc
Seq<Func<A, B>>
sequence of functions
fa
Seq<A>
sequence of argument values
DECLARATION
[Pure]
public static Seq<B> apply<A, B>(Seq<Func<A, B>> fabc, Seq<A> fa)
RETURNS
Seq<B>
Returns the result of applying the sequence argument values to the sequence functions
apply<A, B>(Func<A, B>, Seq<A>)
SUMMARY

Apply a sequence of values to a sequence of functions

PARAMETERS
fabc
Func<A, B>
sequence of functions
fa
Seq<A>
sequence of argument values
DECLARATION
[Pure]
public static Seq<B> apply<A, B>(Func<A, B> fabc, Seq<A> fa)
RETURNS
Seq<B>
Returns the result of applying the sequence argument values to the sequence functions
choose<A, B>(Seq<A>, Func<A, Option<B>>)
SUMMARY

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
list
Seq<A>
sequence
selector
Func<A, Option<B>>
Selector function
DECLARATION
[Pure]
public static Seq<B> choose<A, B>(Seq<A> list, Func<A, Option<B>> selector)
RETURNS
Seq<B>
Mapped and filtered sequence
choose<A, B>(Seq<A>, Func<int, A, Option<B>>)
SUMMARY

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
list
Seq<A>
sequence
selector
Func<int, A, Option<B>>
Selector function
DECLARATION
[Pure]
public static Seq<B> choose<A, B>(Seq<A> list, Func<int, A, Option<B>> selector)
RETURNS
Seq<B>
Mapped and filtered sequence
create<A>()
SUMMARY

Create a new empty sequence

DECLARATION
[Pure]
public static Seq<A> create<A>()
RETURNS
Seq<A>
sequence
create<A>(A)
SUMMARY

Create a sequence from a initial set of items

PARAMETERS
items
A
Items
DECLARATION
[Pure]
public static Seq<A> create<A>(A items)
RETURNS
Seq<A>
sequence
createRange<A>(IEnumerable<A>)
SUMMARY

Create a sequence from an initial set of items

PARAMETERS
items
IEnumerable<A>
Items
DECLARATION
[Pure]
public static Seq<A> createRange<A>(IEnumerable<A> items)
RETURNS
Seq<A>
sequence
distinct<EQ, T>(Seq<T>)
SUMMARY

Return a new sequence with all duplicate values removed

PARAMETERS
list
Seq<T>
sequence
DECLARATION
[Pure]
public static Seq<T> distinct<EQ, T>(Seq<T> list)
RETURNS
Seq<T>
A new sequence with all duplicate values removed
CONSTRAINTS
where EQ : struct Eq<T>
distinct<T, K>(Seq<T>, Func<T, K>, Option<Func<K, K, bool>>)
SUMMARY

Return a new sequence with all duplicate values removed

PARAMETERS
list
Seq<T>
sequence
keySelector
Func<T, K>
compare
Option<Func<K, K, bool>>
DECLARATION
[Pure]
public static Seq<T> distinct<T, K>(Seq<T> list, Func<T, K> keySelector, Option<Func<K, K, bool>> compare = defaultOption<Func<K, K, bool>>)
RETURNS
Seq<T>
A new sequence with all duplicate values removed
distinct<T>(Seq<T>)
SUMMARY

Return a new sequence with all duplicate values removed

PARAMETERS
list
Seq<T>
sequence
DECLARATION
[Pure]
public static Seq<T> distinct<T>(Seq<T> list)
RETURNS
Seq<T>
A new sequence with all duplicate values removed
empty<A>()
SUMMARY

Create an empty sequence

DECLARATION
[Pure]
public static Seq<A> empty<A>()
RETURNS
Seq<A>
exists<T>(Seq<T>, Func<T, bool>)
SUMMARY

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

PARAMETERS
list
Seq<T>
sequence to test
pred
Func<T, bool>
Predicate
DECLARATION
[Pure]
public static bool exists<T>(Seq<T> list, Func<T, bool> pred)
RETURNS
bool
True if any item in the sequence matches the predicate provided
filter<A>(Seq<A>, Func<A, bool>)
SUMMARY

Removes items from the sequence that do not match the given predicate (Where in LINQ)

PARAMETERS
list
Seq<A>
sequence to filter
predicate
Func<A, bool>
Predicate function
DECLARATION
[Pure]
public static Seq<A> filter<A>(Seq<A> list, Func<A, bool> predicate)
RETURNS
Seq<A>
Filtered sequence
find<T>(Seq<T>, Func<T, bool>)
SUMMARY

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

PARAMETERS
list
Seq<T>
sequence to search
pred
Func<T, bool>
Predicate
DECLARATION
[Pure]
public static Option<T> find<T>(Seq<T> list, Func<T, bool> pred)
RETURNS
Option<T>
Some(x) for the first item in the sequence that matches the predicate provided, None otherwise.
findSeq<T>(Seq<T>, Func<T, bool>)
SUMMARY

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

PARAMETERS
list
Seq<T>
sequence to search
pred
Func<T, bool>
Predicate
DECLARATION
[Pure]
public static Seq<T> findSeq<T>(Seq<T> list, Func<T, bool> pred)
RETURNS
Seq<T>
[x] for the first item in the sequence that matches the predicate provided, [] otherwise.
fold<S, T>(Seq<T>, S, Func<S, T, S>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
DECLARATION
[Pure]
public static S fold<S, T>(Seq<T> list, S state, Func<S, T, S> folder)
RETURNS
S
Aggregate value
foldBack<S, T>(Seq<T>, S, Func<S, T, S>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
DECLARATION
[Pure]
public static S foldBack<S, T>(Seq<T> list, S state, Func<S, T, S> folder)
RETURNS
S
Aggregate value
foldBackUntil<S, T>(Seq<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<T, bool>
Predicate function
DECLARATION
[Pure]
public static S foldBackUntil<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldBackUntil<S, T>(Seq<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<S, bool>
Predicate function
DECLARATION
[Pure]
public static S foldBackUntil<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
foldBackWhile<S, T>(Seq<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<T, bool>
Predicate function
DECLARATION
[Pure]
public static S foldBackWhile<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldBackWhile<S, T>(Seq<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<S, bool>
Predicate function
DECLARATION
[Pure]
public static S foldBackWhile<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
foldUntil<S, T>(Seq<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<T, bool>
Predicate function
DECLARATION
[Pure]
public static S foldUntil<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldUntil<S, T>(Seq<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

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
list
Seq<T>
Enumerable to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<S, bool>
Predicate function
DECLARATION
[Pure]
public static S foldUntil<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
foldWhile<S, T>(Seq<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<T, bool>
Predicate function
DECLARATION
[Pure]
public static S foldWhile<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldWhile<S, T>(Seq<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
pred
Func<S, bool>
Predicate function
DECLARATION
[Pure]
public static S foldWhile<S, T>(Seq<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
forall<T>(Seq<T>, Func<T, bool>)
SUMMARY

Returns true if all items in the sequence match a predicate (Any in LINQ)

PARAMETERS
list
Seq<T>
sequence to test
pred
Func<T, bool>
Predicate
DECLARATION
[Pure]
public static bool forall<T>(Seq<T> list, Func<T, bool> pred)
RETURNS
bool
True if all items in the sequence match the predicate
head<A>(Seq<A>)
SUMMARY

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

PARAMETERS
list
Seq<A>
sequence
DECLARATION
[Pure]
public static A head<A>(Seq<A> list)
RETURNS
A
Head item
headOrNone<A>(Seq<A>)
SUMMARY

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

PARAMETERS
list
Seq<A>
sequence
DECLARATION
[Pure]
public static Option<A> headOrNone<A>(Seq<A> list)
RETURNS
Option<A>
Optional head item
init<A>(int, Func<int, A>)
SUMMARY

Generates a sequence of A using the provided delegate to initialise each item.

PARAMETERS
count
int
generator
Func<int, A>
DECLARATION
[Pure]
public static Seq<A> init<A>(int count, Func<int, A> generator)
RETURNS
Seq<A>
iter<T>(Seq<T>, Action<T>)
SUMMARY

Invokes an action for each item in the sequence in order

PARAMETERS
list
Seq<T>
sequence to iterate
action
Action<T>
Action to invoke with each item
DECLARATION
public static Unit iter<T>(Seq<T> list, Action<T> action)
iter<T>(Seq<T>, Action<int, T>)
SUMMARY

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

PARAMETERS
list
Seq<T>
sequence to iterate
action
Action<int, T>
Action to invoke with each item
DECLARATION
public static Unit iter<T>(Seq<T> list, Action<int, T> action)
length<T>(Seq<T>)
SUMMARY

Returns the number of items in the sequence

PARAMETERS
list
Seq<T>
sequence to count
DECLARATION
[Pure]
public static int length<T>(Seq<T> list)
RETURNS
int
The number of items in the sequence
map<A, B>(Seq<A>, Func<A, B>)
SUMMARY

Projects the values in the sequence using a map function into a new sequence (Select in LINQ).

PARAMETERS
list
Seq<A>
sequence to map
map
Func<A, B>
Map function
DECLARATION
[Pure]
public static Seq<B> map<A, B>(Seq<A> list, Func<A, B> map)
RETURNS
Seq<B>
Mapped sequence
map<A, B>(Seq<A>, Func<int, A, B>)
SUMMARY

Projects the values in the sequence using a map function into a new sequence (Select in LINQ). An index value is passed through to the map function also.

PARAMETERS
list
Seq<A>
sequence to map
map
Func<int, A, B>
Map function
DECLARATION
[Pure]
public static Seq<B> map<A, B>(Seq<A> list, Func<int, A, B> map)
RETURNS
Seq<B>
Mapped sequence
reduce<T>(Seq<T>, Func<T, T, T>)
SUMMARY

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
list
Seq<T>
sequence to reduce
reducer
Func<T, T, T>
Reduce function
DECLARATION
[Pure]
public static T reduce<T>(Seq<T> list, Func<T, T, T> reducer)
RETURNS
T
Aggregate value
reduceBack<T>(Seq<T>, Func<T, T, T>)
SUMMARY

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
list
Seq<T>
sequence to reduce
reducer
Func<T, T, T>
Reduce function
DECLARATION
[Pure]
public static T reduceBack<T>(Seq<T> list, Func<T, T, T> reducer)
RETURNS
T
Aggregate value
repeat<A>(A, int)
SUMMARY

Generates a sequence that contains one repeated value.

PARAMETERS
item
A
count
int
DECLARATION
[Pure]
public static Seq<A> repeat<A>(A item, int count)
RETURNS
Seq<A>
rev<T>(Seq<T>)
SUMMARY

Reverses the sequence (Reverse in LINQ)

PARAMETERS
list
Seq<T>
sequence to reverse
DECLARATION
[Pure]
public static Seq<T> rev<T>(Seq<T> list)
RETURNS
Seq<T>
Reversed sequence
scan<S, T>(Seq<T>, S, Func<S, T, S>)
SUMMARY

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
list
Seq<T>
sequence to fold
state
S
Initial state
folder
Func<S, T, S>
Folding function
DECLARATION
[Pure]
public static Seq<S> scan<S, T>(Seq<T> list, S state, Func<S, T, S> folder)
RETURNS
Seq<S>
Aggregate state
scanBack<S, T>(Seq<T>, S, Func<S, T, S>)
SUMMARY

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
list
Seq<T>
Enumerable to fold
state
S
Initial state
folder
Func<S, T, S>
Folding function
DECLARATION
[Pure]
public static Seq<S> scanBack<S, T>(Seq<T> list, S state, Func<S, T, S> folder)
RETURNS
Seq<S>
Aggregate state
span<T>(Seq<T>, Func<T, bool>)
SUMMARY

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
self
Seq<T>
List
pred
Func<T, bool>
Predicate
DECLARATION
[Pure]
public static ValueTuple<Seq<T>, Seq<T>> span<T>(Seq<T> self, Func<T, bool> pred)
RETURNS
ValueTuple<Seq<T>, Seq<T>>
Split list
sum(Seq<int>)
SUMMARY

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

PARAMETERS
list
Seq<int>
List to sum
DECLARATION
[Pure]
public static int sum(Seq<int> list)
RETURNS
int
Sum total
sum(Seq<float>)
SUMMARY

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

PARAMETERS
list
Seq<float>
List to sum
DECLARATION
[Pure]
public static float sum(Seq<float> list)
RETURNS
float
Sum total
sum(Seq<double>)
SUMMARY

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

PARAMETERS
list
Seq<double>
List to sum
DECLARATION
[Pure]
public static double sum(Seq<double> list)
RETURNS
double
Sum total
sum(Seq<decimal>)
SUMMARY

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

PARAMETERS
list
Seq<decimal>
List to sum
DECLARATION
[Pure]
public static decimal sum(Seq<decimal> list)
RETURNS
decimal
Sum total
tail<A>(Seq<A>)
SUMMARY

Get the tail of the sequence (skips the head item)

PARAMETERS
list
Seq<A>
sequence
DECLARATION
[Pure]
public static Seq<A> tail<A>(Seq<A> list)
RETURNS
Seq<A>
Tail sequence
tails<A>(Seq<A>)
SUMMARY

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
self
Seq<A>
Seq
DECLARATION
[Pure]
public static Seq<Seq<A>> tails<A>(Seq<A> self)
RETURNS
Seq<Seq<A>>
Seq of Seq of A
tailsr<A>(Seq<A>)
SUMMARY

The tailsr function returns all final segments of the argument, longest first. For example:

tails(['a','b','c']) == [['a','b','c'], ['b','c'], ['c'],[]]

PARAMETERS
self
Seq<A>
Seq
REMARKS
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.
DECLARATION
[Pure]
public static Seq<Seq<A>> tailsr<A>(Seq<A> self)
RETURNS
Seq<Seq<A>>
Seq of Seq of A
take<T>(Seq<T>, int)
SUMMARY

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

PARAMETERS
list
Seq<T>
sequence
count
int
Number of items to take
DECLARATION
[Pure]
public static Seq<T> take<T>(Seq<T> list, int count)
RETURNS
Seq<T>
A new sequence with the first 'count' items from the sequence provided
takeWhile<T>(Seq<T>, Func<T, bool>)
SUMMARY

Iterate the sequence, yielding items if they match the predicate provided, and stopping as soon as one doesn't

PARAMETERS
list
Seq<T>
sequence
pred
Func<T, bool>
DECLARATION
[Pure]
public static Seq<T> takeWhile<T>(Seq<T> list, Func<T, bool> pred)
RETURNS
Seq<T>
A new sequence with the first items that match the predicate
takeWhile<T>(Seq<T>, Func<T, int, bool>)
SUMMARY

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
list
Seq<T>
sequence
pred
Func<T, int, bool>
DECLARATION
[Pure]
public static Seq<T> takeWhile<T>(Seq<T> list, Func<T, int, bool> pred)
RETURNS
Seq<T>
A new sequence with the first items that match the predicate
zip<T, U, V>(Seq<T>, Seq<U>, Func<T, U, V>)
SUMMARY

Joins two sequences together either into a single sequence using the join function provided

PARAMETERS
list
Seq<T>
First sequence to join
other
Seq<U>
Second sequence to join
zipper
Func<T, U, V>
Join function
DECLARATION
[Pure]
public static Seq<V> zip<T, U, V>(Seq<T> list, Seq<U> other, Func<T, U, V> zipper)
RETURNS
Seq<V>
Joined sequence
zip<T, U>(Seq<T>, Seq<U>)
SUMMARY

Joins two sequences together either into an sequence of tuples

PARAMETERS
list
Seq<T>
First sequence to join
other
Seq<U>
Second sequence to join
DECLARATION
[Pure]
public static Seq<ValueTuple<T, U>> zip<T, U>(Seq<T> list, Seq<U> other)
RETURNS
Seq<ValueTuple<T, U>>
Joined sequence of tuples