Header menu logo TDesu.FSharp

Array Module

Array extensions: stream conversion and allocation-free ValueOption lookups.

Functions and values

Function or value Description

Array.ofMemoryStream memoryStream

Full Usage: Array.ofMemoryStream memoryStream

Parameters:
Returns: byte[]
Modifiers: inline

Converts a to a byte array. A null is treated as empty and yields [||]. The memory stream to convert.

memoryStream : MemoryStream
Returns: byte[]

Array.valueChooseFirst chooser array

Full Usage: Array.valueChooseFirst chooser array

Parameters:
    chooser : 'T -> 'U voption - The function applied to each element; the first ValueSome result is returned.
    array : 'T[] - The array to search.

Returns: 'U voption
Modifiers: inline
Type parameters: 'T, 'U

Applies chooser to each element from the start and returns the first ValueSome result, or ValueNone if every application returns ValueNone. A null array is treated as empty and yields ValueNone.

chooser : 'T -> 'U voption

The function applied to each element; the first ValueSome result is returned.

array : 'T[]

The array to search.

Returns: 'U voption

Array.valueChooseLast chooser array

Full Usage: Array.valueChooseLast chooser array

Parameters:
    chooser : 'T -> 'U voption - The function applied to each element; the first ValueSome result is returned.
    array : 'T[] - The array to search.

Returns: 'U voption
Modifiers: inline
Type parameters: 'T, 'U

Applies chooser to each element from the end and returns the first ValueSome result, or ValueNone if every application returns ValueNone. A null array is treated as empty and yields ValueNone.

chooser : 'T -> 'U voption

The function applied to each element; the first ValueSome result is returned.

array : 'T[]

The array to search.

Returns: 'U voption

Array.valueTryFind filter array

Full Usage: Array.valueTryFind filter array

Parameters:
    filter : 'T -> bool - The predicate to test each element.
    array : 'T[] - The array to search.

Returns: 'T voption
Modifiers: inline
Type parameters: 'T

Returns the first element satisfying filter as ValueSome, or ValueNone if none match. Allocates nothing on either path. A null array is treated as empty and yields ValueNone.

filter : 'T -> bool

The predicate to test each element.

array : 'T[]

The array to search.

Returns: 'T voption

Array.valueTryFindLast filter array

Full Usage: Array.valueTryFindLast filter array

Parameters:
    filter : 'T -> bool - The predicate to test each element.
    array : 'T[] - The array to search.

Returns: 'T voption
Modifiers: inline
Type parameters: 'T

Returns the last element satisfying filter as ValueSome, scanning from the end, or ValueNone if none match. Allocates nothing on either path. A null array is treated as empty and yields ValueNone.

filter : 'T -> bool

The predicate to test each element.

array : 'T[]

The array to search.

Returns: 'T voption

Type something to start searching.