FSharp.Collections.Immutable 1.0.0

Edit this page

FlatList Module

The functions of FlatList that take or return an optional value, with option instead of voption.

After open FSharp.Collections.Immutable.Option, these functions shadow the default ones, and the other functions of the default module stay available (ADR 0001, D3). Each function has the signature of the function with the same name in Array where that module has one.

Nested modules

Modules Description

Parallel

The functions of Parallel that take or return an optional value, with option instead of voption.

Functions and values

Function or value Description

FlatList.choose chooser array

Full Usage: FlatList.choose chooser array

Parameters:
    chooser : 'T -> 'U option - The function that returns a value, or None to skip the element.
    array : FlatList<'T> - The input flat list.

Returns: FlatList<'U> The chosen values.

Returns the values that the chooser returns for the elements.

O(n).

chooser : 'T -> 'U option

The function that returns a value, or None to skip the element.

array : FlatList<'T>

The input flat list.

Returns: FlatList<'U>

The chosen values.

FlatList.pick chooser array

Full Usage: FlatList.pick chooser array

Parameters:
    chooser : 'T -> 'U option - The function that returns a value, or None to go on.
    array : FlatList<'T> - The input flat list.

Returns: 'U The first chosen value.

Returns the first value that the chooser returns for the elements.

O(n).

chooser : 'T -> 'U option

The function that returns a value, or None to go on.

array : FlatList<'T>

The input flat list.

Returns: 'U

The first chosen value.

KeyNotFoundException Thrown when the chooser returns None for every element.

FlatList.tryExactlyOne array

Full Usage: FlatList.tryExactlyOne array

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

Returns: 'T option The only element, or None.

Returns the only element of the flat list, or None when it does not have exactly one element.

O(1).

array : FlatList<'T>

The input flat list.

Returns: 'T option

The only element, or None.

FlatList.tryFind predicate array

Full Usage: FlatList.tryFind predicate array

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

Returns: 'T option The first element that satisfies the predicate, or None.

Returns the first element that satisfies the predicate, or None.

O(n).

predicate : 'T -> bool

The function to test the elements.

array : FlatList<'T>

The input flat list.

Returns: 'T option

The first element that satisfies the predicate, or None.

FlatList.tryFindBack predicate array

Full Usage: FlatList.tryFindBack predicate array

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

Returns: 'T option The last element that satisfies the predicate, or None.

Returns the last element that satisfies the predicate, or None.

O(n).

predicate : 'T -> bool

The function to test the elements.

array : FlatList<'T>

The input flat list.

Returns: 'T option

The last element that satisfies the predicate, or None.

FlatList.tryFindIndex predicate array

Full Usage: FlatList.tryFindIndex predicate array

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

Returns: int option The index of the first element that satisfies the predicate, or None.

Returns the index of the first element that satisfies the predicate, or None.

O(n).

predicate : 'T -> bool

The function to test the elements.

array : FlatList<'T>

The input flat list.

Returns: int option

The index of the first element that satisfies the predicate, or None.

FlatList.tryFindIndexBack predicate array

Full Usage: FlatList.tryFindIndexBack predicate array

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

Returns: int option The index of the last element that satisfies the predicate, or None.

Returns the index of the last element that satisfies the predicate, or None.

O(n).

predicate : 'T -> bool

The function to test the elements.

array : FlatList<'T>

The input flat list.

Returns: int option

The index of the last element that satisfies the predicate, or None.

FlatList.tryHead array

Full Usage: FlatList.tryHead array

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

Returns: 'T option The first element, or None.

Returns the first element of the flat list, or None when it is empty.

O(1).

array : FlatList<'T>

The input flat list.

Returns: 'T option

The first element, or None.

FlatList.tryItem index array

Full Usage: FlatList.tryItem index array

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

Returns: 'T option The element at the index, or None.

Returns the element at an index, or None when the index is out of range.

O(1).

index : int

The index of the element.

array : FlatList<'T>

The input flat list.

Returns: 'T option

The element at the index, or None.

FlatList.tryLast array

Full Usage: FlatList.tryLast array

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

Returns: 'T option The last element, or None.

Returns the last element of the flat list, or None when it is empty.

O(1).

array : FlatList<'T>

The input flat list.

Returns: 'T option

The last element, or None.

FlatList.tryPick chooser array

Full Usage: FlatList.tryPick chooser array

Parameters:
    chooser : 'T -> 'U option - The function that returns a value, or None to go on.
    array : FlatList<'T> - The input flat list.

Returns: 'U option The first chosen value, or None.

Returns the first value that the chooser returns for the elements, or None.

O(n).

chooser : 'T -> 'U option

The function that returns a value, or None to go on.

array : FlatList<'T>

The input flat list.

Returns: 'U option

The first chosen value, or None.

FlatList.tryTail array

Full Usage: FlatList.tryTail array

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

Returns: FlatList<'T> option A copy of the elements after the first one, or None.

Returns the flat list without its first element, or None when it is empty.

O(n).

array : FlatList<'T>

The input flat list.

Returns: FlatList<'T> option

A copy of the elements after the first one, or None.

FlatList.unfold generator state

Full Usage: FlatList.unfold generator state

Parameters:
    generator : 'State -> ('T * 'State) option - The function that returns the next element and state, or None 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) option

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

state : 'State

The initial state.

Returns: FlatList<'T>

The generated flat list.