FSharp.Collections.Immutable 1.0.0

Edit this page

FlatList Module

The functions of FlatList that take or return tuples, with reference tuples instead of struct tuples.

After open FSharp.Collections.Immutable.Tuple, these functions shadow the default ones, and the other functions of the default module stay available (ADR 0001, D3). Optional values stay voption; open the namespace Immutable.Option after this one for the shapes of Array.

Nested modules

Modules Description

Parallel

The functions of Parallel that take or return tuples, with reference tuples instead of struct tuples.

Functions and values

Function or value Description

FlatList.allPairs array1 array2

Full Usage: FlatList.allPairs array1 array2

Parameters:
    array1 : FlatList<'T1> - The first flat list.
    array2 : FlatList<'T2> - The second flat list.

Returns: FlatList<'T1 * 'T2> The pairs, in the order of the first flat list and then of the second one.

Returns every element of the first flat list paired with every element of the second one.

O(n × m).

array1 : FlatList<'T1>

The first flat list.

array2 : FlatList<'T2>

The second flat list.

Returns: FlatList<'T1 * 'T2>

The pairs, in the order of the first flat list and then of the second one.

FlatList.countBy projection array

Full Usage: FlatList.countBy projection array

Parameters:
    projection : 'T -> 'Key - The function that returns the key of an element.
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'Key * int> The keys, in the order of their first occurrence, with the number of their elements.

Counts the elements of each key of a projection.

O(n). The keys compare in F# structural equality.

projection : 'T -> 'Key

The function that returns the key of an element.

array : FlatList<'T>

The input flat list.

Returns: FlatList<'Key * int>

The keys, in the order of their first occurrence, with the number of their elements.

FlatList.groupBy projection array

Full Usage: FlatList.groupBy projection array

Parameters:
    projection : 'T -> 'Key - The function that returns the key of an element.
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'Key * FlatList<'T>> The keys, in the order of their first occurrence, with their elements in their order.

Groups the elements by the key of a projection.

O(n). The keys compare in F# structural equality.

projection : 'T -> 'Key

The function that returns the key of an element.

array : FlatList<'T>

The input flat list.

Returns: FlatList<'Key * FlatList<'T>>

The keys, in the order of their first occurrence, with their elements in their order.

FlatList.indexed array

Full Usage: FlatList.indexed array

Parameters:
    array : FlatList<'T> - The input flat list.

Returns: FlatList<int * 'T> The pairs of index and element.

Returns every element with its index.

O(n).

array : FlatList<'T>

The input flat list.

Returns: FlatList<int * 'T>

The pairs of index and element.

FlatList.mapFold mapping state array

Full Usage: FlatList.mapFold mapping state array

Parameters:
    mapping : 'State -> 'T -> 'Result * 'State - The function that returns the result for an element and the next state.
    state : 'State - The initial state.
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'Result> * 'State The results and the final state.

Maps each element and threads a state through the mapping, from the first element to the last one.

O(n).

mapping : 'State -> 'T -> 'Result * 'State

The function that returns the result for an element and the next state.

state : 'State

The initial state.

array : FlatList<'T>

The input flat list.

Returns: FlatList<'Result> * 'State

The results and the final state.

FlatList.mapFoldBack mapping array state

Full Usage: FlatList.mapFoldBack mapping array state

Parameters:
    mapping : 'T -> 'State -> 'Result * 'State - The function that returns the result for an element and the next state.
    array : FlatList<'T> - The input flat list.
    state : 'State - The initial state.

Returns: FlatList<'Result> * 'State The results, in the order of the elements, and the final state.

Maps each element and threads a state through the mapping, from the last element to the first one.

O(n).

mapping : 'T -> 'State -> 'Result * 'State

The function that returns the result for an element and the next state.

array : FlatList<'T>

The input flat list.

state : 'State

The initial state.

Returns: FlatList<'Result> * 'State

The results, in the order of the elements, and the final state.

FlatList.pairwise array

Full Usage: FlatList.pairwise array

Parameters:
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'T * 'T> The pairs of neighbours; empty for fewer than two elements.

Returns every element with its successor.

O(n).

array : FlatList<'T>

The input flat list.

Returns: FlatList<'T * 'T>

The pairs of neighbours; empty for fewer than two elements.

FlatList.partition predicate array

Full Usage: FlatList.partition predicate array

Parameters:
    predicate : 'T -> bool - The function to test the elements.
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'T> * FlatList<'T> The elements that satisfy the predicate and the other ones, both in their order.

Splits the elements by a predicate.

O(n).

predicate : 'T -> bool

The function to test the elements.

array : FlatList<'T>

The input flat list.

Returns: FlatList<'T> * FlatList<'T>

The elements that satisfy the predicate and the other ones, both in their order.

FlatList.partitionWith partitioner array

Full Usage: FlatList.partitionWith partitioner array

Parameters:
    partitioner : 'T -> Choice<'T1, 'T2> - The function that returns Choice1Of2 or Choice2Of2 for an element.
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'T1> * FlatList<'T2> The values of the first choices and of the second choices, both in the order of the elements.

Splits the elements by the choice that a function returns for them.

O(n).

partitioner : 'T -> Choice<'T1, 'T2>

The function that returns Choice1Of2 or Choice2Of2 for an element.

array : FlatList<'T>

The input flat list.

Returns: FlatList<'T1> * FlatList<'T2>

The values of the first choices and of the second choices, both in the order of the elements.

FlatList.splitAt index array

Full Usage: FlatList.splitAt index array

Parameters:
    index : int - The index of the first element of the second part.
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'T> * FlatList<'T> The elements before the index and the elements from the index.

Splits the flat list at an index.

O(n). The parts are copies, unless they are empty or the whole flat list.

index : int

The index of the first element of the second part.

array : FlatList<'T>

The input flat list.

Returns: FlatList<'T> * FlatList<'T>

The elements before the index and the elements from the index.

ArgumentException Thrown when the index is negative.
InvalidOperationException Thrown when the index exceeds the length.

FlatList.unfold generator state

Full Usage: FlatList.unfold generator state

Parameters:
    generator : 'State -> ('T * 'State) voption - The function that returns the next element and state, or ValueNone to stop.
    state : 'State - The initial state.

Returns: FlatList<'T> The generated flat list.

Creates a flat list from a generator, which returns the next element and the next state.

O(n).

generator : 'State -> ('T * 'State) voption

The function that returns the next element and state, or ValueNone to stop.

state : 'State

The initial state.

Returns: FlatList<'T>

The generated flat list.

FlatList.unzip array

Full Usage: FlatList.unzip array

Parameters:
    array : FlatList<'T1 * 'T2> - The input flat list.

Returns: FlatList<'T1> * FlatList<'T2> The first components and the second components.

Splits a flat list of pairs into two flat lists.

O(n).

array : FlatList<'T1 * 'T2>

The input flat list.

Returns: FlatList<'T1> * FlatList<'T2>

The first components and the second components.

FlatList.unzip3 array

Full Usage: FlatList.unzip3 array

Parameters:
    array : FlatList<'T1 * 'T2 * 'T3> - The input flat list.

Returns: FlatList<'T1> * FlatList<'T2> * FlatList<'T3> The first, the second and the third components.

Splits a flat list of triples into three flat lists.

O(n).

array : FlatList<'T1 * 'T2 * 'T3>

The input flat list.

Returns: FlatList<'T1> * FlatList<'T2> * FlatList<'T3>

The first, the second and the third components.

FlatList.zip array1 array2

Full Usage: FlatList.zip array1 array2

Parameters:
    array1 : FlatList<'T1> - The first flat list.
    array2 : FlatList<'T2> - The second flat list.

Returns: FlatList<'T1 * 'T2> The pairs of elements at the same index.

Combines two flat lists into a flat list of pairs.

O(n).

array1 : FlatList<'T1>

The first flat list.

array2 : FlatList<'T2>

The second flat list.

Returns: FlatList<'T1 * 'T2>

The pairs of elements at the same index.

ArgumentException Thrown when the flat lists have different lengths.

FlatList.zip3 array1 array2 array3

Full Usage: FlatList.zip3 array1 array2 array3

Parameters:
    array1 : FlatList<'T1> - The first flat list.
    array2 : FlatList<'T2> - The second flat list.
    array3 : FlatList<'T3> - The third flat list.

Returns: FlatList<'T1 * 'T2 * 'T3> The triples of elements at the same index.

Combines three flat lists into a flat list of triples.

O(n).

array1 : FlatList<'T1>

The first flat list.

array2 : FlatList<'T2>

The second flat list.

array3 : FlatList<'T3>

The third flat list.

Returns: FlatList<'T1 * 'T2 * 'T3>

The triples of elements at the same index.

ArgumentException Thrown when the flat lists have different lengths.