Logo ArrayT

UtilArray Module

Internal utilities for array operations and exception handling.

Types

Type Description

DebugIndexer<'T>

A simple Wrapper for an array. The sole purpose is to provide a better Exception message when an index is out of range.

Functions and values

Function or value Description

badCountExn arr funcName expected

Full Usage: badCountExn arr funcName expected

Parameters:
    arr : 'T[] - The input array.
    funcName : string - The name of the function that failed.
    expected : string - A description of the expected item count, e.g. "exactly one item".

Returns: 'a Never returns (always raises).
Type parameters: 'T, 'a

Raises an IndexOutOfRangeException when the array does not have the expected number of items.

arr : 'T[]

The input array.

funcName : string

The name of the function that failed.

expected : string

A description of the expected item count, e.g. "exactly one item".

Returns: 'a

Never returns (always raises).

badGetExn i arr funcName

Full Usage: badGetExn i arr funcName

Parameters:
    i : int - The invalid index.
    arr : 'T[] - The input array.
    funcName : string - The name of the function that failed.

Returns: 'a Never returns (always raises).
Type parameters: 'T, 'a

Raises an IndexOutOfRangeException for invalid get operations.

i : int

The invalid index.

arr : 'T[]

The input array.

funcName : string

The name of the function that failed.

Returns: 'a

Never returns (always raises).

badSetExn i arr funcName doingSet

Full Usage: badSetExn i arr funcName doingSet

Parameters:
    i : int - The invalid index.
    arr : 'T[] - The input array.
    funcName : string - The name of the function that failed.
    doingSet : 'T - The value being set.

Returns: 'a Never returns (always raises).
Type parameters: 'T, 'a

Raises an IndexOutOfRangeException for invalid set operations.

i : int

The invalid index.

arr : 'T[]

The input array.

funcName : string

The name of the function that failed.

doingSet : 'T

The value being set.

Returns: 'a

Never returns (always raises).

contentAsString entriesToPrint arr

Full Usage: contentAsString entriesToPrint arr

Parameters:
    entriesToPrint : int - The maximum number of entries to display.
    arr : 'T[] - The input array.

Returns: string A formatted string showing array contents.
Type parameters: 'T

Returns a string with the content of the array up to 'entriesToPrint' entries. Includes the index of each entry. Includes the last entry.

entriesToPrint : int

The maximum number of entries to display.

arr : 'T[]

The input array.

Returns: string

A formatted string showing array contents.

fail arr funcAndReason

Full Usage: fail arr funcAndReason

Parameters:
    arr : 'T[] - The input array.
    funcAndReason : string - A string describing the function and reason for failure.

Returns: 'a Never returns (always raises).
Type parameters: 'T, 'a

Raises an ArrayTArgumentException with a descriptive message about array operation failure.

arr : 'T[]

The input array.

funcAndReason : string

A string describing the function and reason for failure.

Returns: 'a

Never returns (always raises).

failIdx arr funcAndReason

Full Usage: failIdx arr funcAndReason

Parameters:
    arr : 'T[] - The input array.
    funcAndReason : string - A string describing the function and reason for failure.

Returns: 'a Never returns (always raises).
Type parameters: 'T, 'a

Raises an IndexOutOfRangeException with a descriptive message about array operation failure.

arr : 'T[]

The input array.

funcAndReason : string

A string describing the function and reason for failure.

Returns: 'a

Never returns (always raises).

failKey arr funcAndReason

Full Usage: failKey arr funcAndReason

Parameters:
    arr : 'T[] - The input array.
    funcAndReason : string - A string describing the function and reason for failure.

Returns: 'a Never returns (always raises).
Type parameters: 'T, 'a

Raises an ArrayTKeyNotFoundException with a descriptive message about array operation failure.

arr : 'T[]

The input array.

funcAndReason : string

A string describing the function and reason for failure.

Returns: 'a

Never returns (always raises).

getUnCkd i arr

Full Usage: getUnCkd i arr

Parameters:
    i : int - The index to access.
    arr : 'T[] - The input array.

Returns: 'T The value at the specified index.
Modifiers: inline
Type parameters: 'T

Gets the value at index i, skipping bounds check in compiled JS code.

i : int

The index to access.

arr : 'T[]

The input array.

Returns: 'T

The value at the specified index.

isNegZero x

Full Usage: isNegZero x

Parameters:
    x : ^F - The float to test.

Returns: bool True if x is -0.0.
Modifiers: inline
Type parameters: ^F, ^a, ^b (requires equality and (static member get_Zero : -> ^F) and (static member op_Division : ^a * ^F -> ^b) and (static member get_One : -> ^a) and (static member op_Division : ^a * ^F -> ^b) and (static member get_Zero : -> ^b) and comparison)

True for -0.0. For float and float32.

x : ^F

The float to test.

Returns: bool

True if x is -0.0.

itemInOneLineWithMaxChars charCount item

Full Usage: itemInOneLineWithMaxChars charCount item

Parameters:
    charCount : int
    item : 'T

Returns: string
Type parameters: 'T
charCount : int
item : 'T
Returns: string

maximumFloat arr

Full Usage: maximumFloat arr

Parameters:
    arr : float[] - The input array.

Returns: float The biggest float, or NaN.

The IEEE 754:2019 'maximum' of a non-empty float array.

arr : float[]

The input array.

Returns: float

The biggest float, or NaN.

maximumFloat32 arr

Full Usage: maximumFloat32 arr

Parameters:
    arr : float32[] - The input array.

Returns: float32 The biggest float32, or NaN.

The IEEE 754:2019 'maximum' of a non-empty float32 array.

arr : float32[]

The input array.

Returns: float32

The biggest float32, or NaN.

maximumNumberFloat arr

Full Usage: maximumNumberFloat arr

Parameters:
    arr : float[] - The input array.

Returns: float The biggest float that is not NaN.

The IEEE 754:2019 'maximumNumber' of a non-empty float array.

arr : float[]

The input array.

Returns: float

The biggest float that is not NaN.

maximumNumberFloat32 arr

Full Usage: maximumNumberFloat32 arr

Parameters:
    arr : float32[] - The input array.

Returns: float32 The biggest float32 that is not NaN.

The IEEE 754:2019 'maximumNumber' of a non-empty float32 array.

arr : float32[]

The input array.

Returns: float32

The biggest float32 that is not NaN.

maximumNumberOf a b

Full Usage: maximumNumberOf a b

Parameters:
    a : ^F - The first float.
    b : ^F - The second float.

Returns: ^F The bigger float that is not NaN.
Modifiers: inline
Type parameters: ^F, ^a, ^b (requires comparison and (static member get_Zero : -> ^F) and (static member op_Division : ^a * ^F -> ^b) and (static member get_One : -> ^a) and (static member op_Division : ^a * ^F -> ^b) and (static member get_Zero : -> ^b) and comparison)

The IEEE 754:2019 'maximumNumber' of two floats: NaN is skipped and +0.0 is bigger than -0.0. Returns NaN only if both are NaN.

a : ^F

The first float.

b : ^F

The second float.

Returns: ^F

The bigger float that is not NaN.

maximumOf a b

Full Usage: maximumOf a b

Parameters:
    a : ^F - The first float.
    b : ^F - The second float.

Returns: ^F The bigger float, or NaN.
Modifiers: inline
Type parameters: ^F, ^a, ^b (requires comparison and (static member get_Zero : -> ^F) and (static member op_Division : ^a * ^F -> ^b) and (static member get_One : -> ^a) and (static member op_Division : ^a * ^F -> ^b) and (static member get_Zero : -> ^b) and comparison)

The IEEE 754:2019 'maximum' of two floats: NaN propagates and +0.0 is bigger than -0.0.

a : ^F

The first float.

b : ^F

The second float.

Returns: ^F

The bigger float, or NaN.

minimumFloat arr

Full Usage: minimumFloat arr

Parameters:
    arr : float[] - The input array.

Returns: float The smallest float, or NaN.

The IEEE 754:2019 'minimum' of a non-empty float array.

arr : float[]

The input array.

Returns: float

The smallest float, or NaN.

minimumFloat32 arr

Full Usage: minimumFloat32 arr

Parameters:
    arr : float32[] - The input array.

Returns: float32 The smallest float32, or NaN.

The IEEE 754:2019 'minimum' of a non-empty float32 array.

arr : float32[]

The input array.

Returns: float32

The smallest float32, or NaN.

minimumNumberFloat arr

Full Usage: minimumNumberFloat arr

Parameters:
    arr : float[] - The input array.

Returns: float The smallest float that is not NaN.

The IEEE 754:2019 'minimumNumber' of a non-empty float array.

arr : float[]

The input array.

Returns: float

The smallest float that is not NaN.

minimumNumberFloat32 arr

Full Usage: minimumNumberFloat32 arr

Parameters:
    arr : float32[] - The input array.

Returns: float32 The smallest float32 that is not NaN.

The IEEE 754:2019 'minimumNumber' of a non-empty float32 array.

arr : float32[]

The input array.

Returns: float32

The smallest float32 that is not NaN.

minimumNumberOf a b

Full Usage: minimumNumberOf a b

Parameters:
    a : ^F - The first float.
    b : ^F - The second float.

Returns: ^F The smaller float that is not NaN.
Modifiers: inline
Type parameters: ^F, ^a, ^b (requires comparison and (static member get_Zero : -> ^F) and (static member op_Division : ^a * ^F -> ^b) and (static member get_One : -> ^a) and (static member op_Division : ^a * ^F -> ^b) and (static member get_Zero : -> ^b) and comparison)

The IEEE 754:2019 'minimumNumber' of two floats: NaN is skipped and -0.0 is smaller than +0.0. Returns NaN only if both are NaN.

a : ^F

The first float.

b : ^F

The second float.

Returns: ^F

The smaller float that is not NaN.

minimumOf a b

Full Usage: minimumOf a b

Parameters:
    a : ^F - The first float.
    b : ^F - The second float.

Returns: ^F The smaller float, or NaN.
Modifiers: inline
Type parameters: ^F, ^a, ^b (requires comparison and (static member get_Zero : -> ^F) and (static member op_Division : ^a * ^F -> ^b) and (static member get_One : -> ^a) and (static member op_Division : ^a * ^F -> ^b) and (static member get_Zero : -> ^b) and comparison)

The IEEE 754:2019 'minimum' of two floats: NaN propagates and -0.0 is smaller than +0.0.

a : ^F

The first float.

b : ^F

The second float.

Returns: ^F

The smaller float, or NaN.

negIdxLooped i length

Full Usage: negIdxLooped i length

Parameters:
    i : int - The index to convert (can be any integer).
    length : int - The length of the array (must be > 0).

Returns: int A valid looped index.
Modifiers: inline

Any int will give a valid index for given collection size. Converts negative indices to positive ones and loops to start after last index is reached. Returns a valid index for a collection of 'length' items for any integer. Requires length > 0.

i : int

The index to convert (can be any integer).

length : int

The length of the array (must be > 0).

Returns: int

A valid looped index.

nullExn funcName

Full Usage: nullExn funcName

Parameters:
    funcName : string - The name of the function that received null input.

Returns: 'a Never returns (always raises).
Type parameters: 'a

Raises an ArrayTArgumentNullException for a null array input.

funcName : string

The name of the function that received null input.

Returns: 'a

Never returns (always raises).

retype x

Full Usage: retype x

Parameters:
    x : 'T - The value to cast.

Returns: 'U The same value, typed as 'U.
Modifiers: inline
Type parameters: 'T, 'U

Casts x to 'U. Only use it when 'T and 'U are known to be the same type at runtime.

x : 'T

The value to cast.

Returns: 'U

The same value, typed as 'U.

setUnCkd i v arr

Full Usage: setUnCkd i v arr

Parameters:
    i : int - The index to set.
    v : 'T - The value to set.
    arr : 'T[] - The input array.

Modifiers: inline
Type parameters: 'T

Sets the value at index i, skipping bounds check in compiled JS code.

i : int

The index to set.

v : 'T

The value to set.

arr : 'T[]

The input array.

toStringCore ofType arr

Full Usage: toStringCore ofType arr

Parameters:
    ofType : 'a - The type name as a string.
    arr : 'T[] - The input array.

Returns: string A string describing the array.
Modifiers: inline
Type parameters: 'a, 'T

Converts an array to a string representation showing its type and item count.

ofType : 'a

The type name as a string.

arr : 'T[]

The input array.

Returns: string

A string describing the array.

toStringInline arr

Full Usage: toStringInline arr

Parameters:
    arr : 'T[] - The input array.

Returns: string A string describing the array.
Modifiers: inline
Type parameters: 'T

Converts an array to a string representation using runtime type information.

arr : 'T[]

The input array.

Returns: string

A string describing the array.

Type something to start searching.