List Class

DECLARATION
public static partial class List
NAMESPACE
LanguageExt

Methods

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

Evaluate fa, then fb, ignoring the result of fa

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

Add an item to the list

PARAMETERS
list
Lst<T>
List
value
T
Item to add
DECLARATION
[Pure]
public static Lst<T> add<T>(Lst<T> list, T value)
RETURNS
Lst<T>
A new Lst T
addRange<T>(Lst<T>, IEnumerable<T>)
SUMMARY

Add a range of items to the list

PARAMETERS
list
Lst<T>
List
value
IEnumerable<T>
Items to add
DECLARATION
[Pure]
public static Lst<T> addRange<T>(Lst<T> list, IEnumerable<T> value)
RETURNS
Lst<T>
A new Lst T
append<T>(IEnumerable<T>, IEnumerable<T>)
SUMMARY

Concatenate two enumerables (Concat in LINQ)

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

Concatenate an enumerable and an enumerable of enumerables

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

Concatenate N enumerables

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Apply an IEnumerable of values to an IEnumerable of functions

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

Apply an IEnumerable of values to an IEnumerable of functions

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

Applies the given function 'selector' to each element of the list. Returns the list comprised of the results for each element where the function returns Some(f(x)).

PARAMETERS
list
IEnumerable<T>
Enumerable
selector
Func<T, Option<R>>
Selector function
DECLARATION
[Pure]
public static IEnumerable<R> choose<T, R>(IEnumerable<T> list, Func<T, Option<R>> selector)
RETURNS
IEnumerable<R>
Mapped and filtered enumerable
choose<T, R>(IEnumerable<T>, Func<int, T, Option<R>>)
SUMMARY

Applies the given function 'selector' to each element of the list. Returns the list 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
IEnumerable<T>
Enumerable
selector
Func<int, T, Option<R>>
Selector function
DECLARATION
[Pure]
public static IEnumerable<R> choose<T, R>(IEnumerable<T> list, Func<int, T, Option<R>> selector)
RETURNS
IEnumerable<R>
Mapped and filtered enumerable
collect<T, R>(IEnumerable<T>, Func<T, IEnumerable<R>>)
SUMMARY

For each element of the list, applies the given function. Concatenates all the results and returns the combined list.

PARAMETERS
list
IEnumerable<T>
Enumerable to map
map
Func<T, IEnumerable<R>>
Map function
DECLARATION
[Pure]
public static IEnumerable<R> collect<T, R>(IEnumerable<T> list, Func<T, IEnumerable<R>> map)
RETURNS
IEnumerable<R>
Mapped enumerable
create<T>()
SUMMARY

Create a new empty list

DECLARATION
[Pure]
public static Lst<T> create<T>()
RETURNS
Lst<T>
Lst T
create<T>(T)
SUMMARY

Create a list from a initial set of items

PARAMETERS
items
T
Items
DECLARATION
[Pure]
public static Lst<T> create<T>(T items)
RETURNS
Lst<T>
Lst T
createRange<T>(IEnumerable<T>)
SUMMARY

Create a list from an initial set of items

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

Return a new enumerable with all duplicate values removed

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

Return a new enumerable with all duplicate values removed

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

Return a new enumerable with all duplicate values removed

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

Create an empty IEnumerable T

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

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

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

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

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

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

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

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

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

Applies a function 'folder' to each element of the collection, 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 list. 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
IEnumerable<T>
Enumerable to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
DECLARATION
[Pure]
public static S fold<S, T>(IEnumerable<T> list, S state, Func<S, T, S> folder)
RETURNS
S
Aggregate value
foldBack<S, T>(IEnumerable<T>, S, Func<S, T, S>)
SUMMARY

Applies a function 'folder' to each element of the collection (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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<T>
Enumerable to fold
state
S
Initial state
folder
Func<S, T, S>
Fold function
DECLARATION
[Pure]
public static S foldBack<S, T>(IEnumerable<T> list, S state, Func<S, T, S> folder)
RETURNS
S
Aggregate value
foldBackUntil<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection (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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<T>
Enumerable 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>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldBackUntil<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection (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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<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 foldBackUntil<S, T>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
foldBackWhile<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection (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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<T>
Enumerable 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>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldBackWhile<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection (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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<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 foldBackWhile<S, T>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
foldUntil<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection 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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<T>
Enumerable 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>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldUntil<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection, 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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<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>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
foldWhile<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<T, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection 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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<T>
Enumerable 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>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<T, bool> pred)
RETURNS
S
Aggregate value
foldWhile<S, T>(IEnumerable<T>, S, Func<S, T, S>, Func<S, bool>)
SUMMARY

Applies a function 'folder' to each element of the collection, 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 list. Then, it feeds this result into the function 'folder' along with the second element, and so on. It returns the final result.

PARAMETERS
list
IEnumerable<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 foldWhile<S, T>(IEnumerable<T> list, S state, Func<S, T, S> folder, Func<S, bool> pred)
RETURNS
S
Aggregate value
forall<T>(IEnumerable<T>, Func<T, bool>)
SUMMARY

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

PARAMETERS
list
IEnumerable<T>
Enumerable to test
pred
Func<T, bool>
Predicate
DECLARATION
[Pure]
public static bool forall<T>(IEnumerable<T> list, Func<T, bool> pred)
RETURNS
bool
True if all items in the enumerable match the predicate
freeze<PredList, PredItem, T>(IEnumerable<T>)
SUMMARY

Convert any enumerable into an immutable Lst T

PARAMETERS
list
IEnumerable<T>
Enumerable to convert
DECLARATION
[Pure]
public static Lst<PredList, PredItem, T> freeze<PredList, PredItem, T>(IEnumerable<T> list)
RETURNS
Lst<PredList, PredItem, T>
Lst of T
CONSTRAINTS
where PredItem : struct Pred<T>
where PredList : struct Pred<ListInfo>
freeze<PredList, T>(IEnumerable<T>)
SUMMARY

Convert any enumerable into an immutable Lst T

PARAMETERS
list
IEnumerable<T>
Enumerable to convert
DECLARATION
[Pure]
public static Lst<PredList, T> freeze<PredList, T>(IEnumerable<T> list)
RETURNS
Lst<PredList, T>
Lst of T
CONSTRAINTS
where PredList : struct Pred<ListInfo>
freeze<T>(IEnumerable<T>)
SUMMARY

Convert any enumerable into an immutable Lst T

PARAMETERS
list
IEnumerable<T>
Enumerable to convert
DECLARATION
[Pure]
public static Lst<T> freeze<T>(IEnumerable<T> list)
RETURNS
Lst<T>
Lst of T
head<T>(IEnumerable<T>)
SUMMARY

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

PARAMETERS
list
IEnumerable<T>
List
DECLARATION
[Pure]
public static T head<T>(IEnumerable<T> list)
RETURNS
T
Head item
headOrNone<T>(IEnumerable<T>)
SUMMARY

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

PARAMETERS
list
IEnumerable<T>
List
DECLARATION
[Pure]
public static Option<T> headOrNone<T>(IEnumerable<T> list)
RETURNS
Option<T>
Optional head item
headSafe<T>(IEnumerable<T>)
PARAMETERS
list
IEnumerable<T>
DECLARATION
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("headSafe has been deprecated, please use headOrNone")]
public static Option<T> headSafe<T>(IEnumerable<T> list)
RETURNS
Option<T>
init<T>(int, Func<int, T>)
SUMMARY

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

PARAMETERS
count
int
generator
Func<int, T>
DECLARATION
[Pure]
public static IEnumerable<T> init<T>(int count, Func<int, T> generator)
RETURNS
IEnumerable<T>
initInfinite<T>(Func<int, T>)
SUMMARY

Generates an infinite sequence of T using the provided delegate to initialise each item.

Remarks: Not truly infinite, will end at Int32.MaxValue

PARAMETERS
generator
Func<int, T>
DECLARATION
[Pure]
public static IEnumerable<T> initInfinite<T>(Func<int, T> generator)
RETURNS
IEnumerable<T>
iter<T>(IEnumerable<T>, Action<T>)
SUMMARY

Invokes an action for each item in the enumerable in order

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

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

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

Returns the number of items in the enumerable

PARAMETERS
list
IEnumerable<T>
Enumerable to count
DECLARATION
[Pure]
public static int length<T>(IEnumerable<T> list)
RETURNS
int
The number of items in the enumerable
map<T, R>(IEnumerable<T>, Func<T, R>)
SUMMARY

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

PARAMETERS
list
IEnumerable<T>
Enumerable to map
map
Func<T, R>
Map function
DECLARATION
[Pure]
public static IEnumerable<R> map<T, R>(IEnumerable<T> list, Func<T, R> map)
RETURNS
IEnumerable<R>
Mapped enumerable
map<T, R>(IEnumerable<T>, Func<int, T, R>)
SUMMARY

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

PARAMETERS
list
IEnumerable<T>
Enumerable to map
map
Func<int, T, R>
Map function
DECLARATION
[Pure]
public static IEnumerable<R> map<T, R>(IEnumerable<T> list, Func<int, T, R> map)
RETURNS
IEnumerable<R>
Mapped enumerable
parmap<T1, T2, R>(IEnumerable<T1>, Func<T1, T2, R>)
SUMMARY

Partial application map

PARAMETERS
list
IEnumerable<T1>
func
Func<T1, T2, R>
REMARKS
TODO: Better documentation of this function
DECLARATION
[Pure]
public static IEnumerable<Func<T2, R>> parmap<T1, T2, R>(IEnumerable<T1> list, Func<T1, T2, R> func)
RETURNS
IEnumerable<Func<T2, R>>
parmap<T1, T2, T3, R>(IEnumerable<T1>, Func<T1, T2, T3, R>)
SUMMARY

Partial application map

PARAMETERS
list
IEnumerable<T1>
func
Func<T1, T2, T3, R>
REMARKS
TODO: Better documentation of this function
DECLARATION
[Pure]
public static IEnumerable<Func<T2, Func<T3, R>>> parmap<T1, T2, T3, R>(IEnumerable<T1> list, Func<T1, T2, T3, R> func)
RETURNS
IEnumerable<Func<T2, Func<T3, R>>>
reduce<T>(IEnumerable<T>, Func<T, T, T>)
SUMMARY

Applies a function to each element of the collection (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 list. Then, it passes this result into the function along with the third element and so on. Finally, it returns the final result.

PARAMETERS
list
IEnumerable<T>
Enumerable to reduce
reducer
Func<T, T, T>
Reduce function
DECLARATION
[Pure]
public static T reduce<T>(IEnumerable<T> list, Func<T, T, T> reducer)
RETURNS
T
Aggregate value
reduceBack<T>(IEnumerable<T>, Func<T, T, T>)
SUMMARY

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

PARAMETERS
list
IEnumerable<T>
Enumerable to reduce
reducer
Func<T, T, T>
Reduce function
DECLARATION
[Pure]
public static T reduceBack<T>(IEnumerable<T> list, Func<T, T, T> reducer)
RETURNS
T
Aggregate value
remove<T>(Lst<T>, T)
SUMMARY

Remove an item from the list

PARAMETERS
list
Lst<T>
List
value
T
value to remove
DECLARATION
[Pure]
public static Lst<T> remove<T>(Lst<T> list, T value)
RETURNS
Lst<T>
A new Lst T
removeAt<T>(Lst<T>, int)
SUMMARY

Remove an item at a specified index in the list

PARAMETERS
list
Lst<T>
List
index
int
Index of item to remove
DECLARATION
[Pure]
public static Lst<T> removeAt<T>(Lst<T> list, int index)
RETURNS
Lst<T>
A new Lst T
repeat<T>(T, int)
SUMMARY

Generates a sequence that contains one repeated value.

PARAMETERS
item
T
count
int
DECLARATION
[Pure]
public static IEnumerable<T> repeat<T>(T item, int count)
RETURNS
IEnumerable<T>
rev<PredList, PredItem, T>(Lst<PredList, PredItem, T>)
SUMMARY

Reverses the list (Reverse in LINQ)

PARAMETERS
list
Lst<PredList, PredItem, T>
List to reverse
DECLARATION
[Pure]
public static Lst<PredList, PredItem, T> rev<PredList, PredItem, T>(Lst<PredList, PredItem, T> list)
RETURNS
Lst<PredList, PredItem, T>
Reversed list
CONSTRAINTS
where PredList : struct Pred<ListInfo>
where PredItem : struct Pred<T>
rev<PredList, T>(Lst<PredList, T>)
SUMMARY

Reverses the list (Reverse in LINQ)

PARAMETERS
list
Lst<PredList, T>
List to reverse
DECLARATION
[Pure]
public static Lst<PredList, T> rev<PredList, T>(Lst<PredList, T> list)
RETURNS
Lst<PredList, T>
Reversed list
CONSTRAINTS
where PredList : struct Pred<ListInfo>
rev<T>(IEnumerable<T>)
SUMMARY

Reverses the enumerable (Reverse in LINQ)

PARAMETERS
list
IEnumerable<T>
Enumerable to reverse
DECLARATION
[Pure]
public static IEnumerable<T> rev<T>(IEnumerable<T> list)
RETURNS
IEnumerable<T>
Reversed enumerable
rev<T>(Lst<T>)
SUMMARY

Reverses the list (Reverse in LINQ)

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

Applies a function to each element of the collection, 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 list. 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
IEnumerable<T>
Enumerable to fold
state
S
Initial state
folder
Func<S, T, S>
Folding function
DECLARATION
[Pure]
public static IEnumerable<S> scan<S, T>(IEnumerable<T> list, S state, Func<S, T, S> folder)
RETURNS
IEnumerable<S>
Aggregate state
scanBack<S, T>(IEnumerable<T>, S, Func<S, T, S>)
SUMMARY

Applies a function to each element of the collection (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 list. 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
IEnumerable<T>
Enumerable to fold
state
S
Initial state
folder
Func<S, T, S>
Folding function
DECLARATION
[Pure]
public static IEnumerable<S> scanBack<S, T>(IEnumerable<T> list, S state, Func<S, T, S> folder)
RETURNS
IEnumerable<S>
Aggregate state
span<T>(IEnumerable<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
IEnumerable<T>
List
pred
Func<T, bool>
Predicate
DECLARATION
[Pure]
public static ValueTuple<IEnumerable<T>, IEnumerable<T>> span<T>(IEnumerable<T> self, Func<T, bool> pred)
RETURNS
ValueTuple<IEnumerable<T>, IEnumerable<T>>
Split list
sum(IEnumerable<int>)
SUMMARY

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

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

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

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

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

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

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

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

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

PARAMETERS
list
IEnumerable<T>
List
DECLARATION
[Pure]
public static IEnumerable<T> tail<T>(IEnumerable<T> list)
RETURNS
IEnumerable<T>
Enumerable of T
tails<T>(IEnumerable<T>)
SUMMARY

The tails function returns all final segments of the argument, longest first. For example, i.e. tails(['a','b','c']) == [['a','b','c'], ['b','c'], ['c'],[]]

PARAMETERS
self
IEnumerable<T>
List
DECLARATION
[Pure]
public static IEnumerable<IEnumerable<T>> tails<T>(IEnumerable<T> self)
RETURNS
IEnumerable<IEnumerable<T>>
Enumerable of Enumerables of T
take<T>(IEnumerable<T>, int)
SUMMARY

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

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

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

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

Iterate the list, 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
IEnumerable<T>
Enumerable
pred
Func<T, int, bool>
DECLARATION
[Pure]
public static IEnumerable<T> takeWhile<T>(IEnumerable<T> list, Func<T, int, bool> pred)
RETURNS
IEnumerable<T>
A new enumerable with the first items that match the predicate
unfold<S, T>(S, Func<S, Option<Tuple<T, S>>>)
SUMMARY

Generate a new list from an intial state value and an 'unfolding' function. An aggregate state value is threaded through separately to the yielded value. The unfold function generates the items in the resulting list until None is returned.

PARAMETERS
state
S
Initial state
unfolder
Func<S, Option<Tuple<T, S>>>
Unfold function
DECLARATION
[Pure]
public static IEnumerable<T> unfold<S, T>(S state, Func<S, Option<Tuple<T, S>>> unfolder)
RETURNS
IEnumerable<T>
Unfolded enumerable
unfold<S>(S, Func<S, Option<S>>)
SUMMARY

Generate a new list from an intial state value and an 'unfolding' function. The unfold function generates the items in the resulting list until None is returned.

PARAMETERS
state
S
Initial state
unfolder
Func<S, Option<S>>
Unfold function
DECLARATION
[Pure]
public static IEnumerable<S> unfold<S>(S state, Func<S, Option<S>> unfolder)
RETURNS
IEnumerable<S>
Unfolded enumerable
unfold<S1, S2, S3, S4, T>(Tuple<S1, S2, S3, S4>, Func<S1, S2, S3, S4, Option<Tuple<T, S1, S2, S3, S4>>>)
SUMMARY

Generate a new list from an intial state value and an 'unfolding' function. An aggregate state value is threaded through separately to the yielded value. The unfold function generates the items in the resulting list until None is returned.

PARAMETERS
state
Tuple<S1, S2, S3, S4>
Initial state
unfolder
Func<S1, S2, S3, S4, Option<Tuple<T, S1, S2, S3, S4>>>
Unfold function
DECLARATION
[Pure]
public static IEnumerable<T> unfold<S1, S2, S3, S4, T>(Tuple<S1, S2, S3, S4> state, Func<S1, S2, S3, S4, Option<Tuple<T, S1, S2, S3, S4>>> unfolder)
RETURNS
IEnumerable<T>
Unfolded enumerable
unfold<S1, S2, S3, T>(Tuple<S1, S2, S3>, Func<S1, S2, S3, Option<Tuple<T, S1, S2, S3>>>)
SUMMARY

Generate a new list from an intial state value and an 'unfolding' function. An aggregate state value is threaded through separately to the yielded value. The unfold function generates the items in the resulting list until None is returned.

PARAMETERS
state
Tuple<S1, S2, S3>
Initial state
unfolder
Func<S1, S2, S3, Option<Tuple<T, S1, S2, S3>>>
Unfold function
DECLARATION
[Pure]
public static IEnumerable<T> unfold<S1, S2, S3, T>(Tuple<S1, S2, S3> state, Func<S1, S2, S3, Option<Tuple<T, S1, S2, S3>>> unfolder)
RETURNS
IEnumerable<T>
Unfolded enumerable
unfold<S1, S2, T>(Tuple<S1, S2>, Func<S1, S2, Option<Tuple<T, S1, S2>>>)
SUMMARY

Generate a new list from an intial state value and an 'unfolding' function. An aggregate state value is threaded through separately to the yielded value. The unfold function generates the items in the resulting list until None is returned.

PARAMETERS
state
Tuple<S1, S2>
Initial state
unfolder
Func<S1, S2, Option<Tuple<T, S1, S2>>>
Unfold function
DECLARATION
[Pure]
public static IEnumerable<T> unfold<S1, S2, T>(Tuple<S1, S2> state, Func<S1, S2, Option<Tuple<T, S1, S2>>> unfolder)
RETURNS
IEnumerable<T>
Unfolded enumerable
zip<T, U, V>(IEnumerable<T>, IEnumerable<U>, Func<T, U, V>)
SUMMARY

Joins two enumerables together either into a single enumerable using the join function provided

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

Joins two enumerables together either into an enumerables of tuples

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