UtilArray Module
Internal utilities for array operations and exception handling.
Types
| Type | Description |
|
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
|
Full Usage:
badGetExn i arr funcName
Parameters:
int
-
The invalid index.
arr : 'T[]
-
The input array.
funcName : string
-
The name of the function that failed.
Returns: 'a
Never returns (always raises).
|
Raises an IndexOutOfRangeException for invalid get operations.
|
Full Usage:
badSetExn i arr funcName doingSet
Parameters:
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).
|
Raises an IndexOutOfRangeException for invalid set operations.
|
Full Usage:
contentAsString entriesToPrint arr
Parameters:
int
-
The maximum number of entries to display.
arr : 'T[]
-
The input array.
Returns: string
A formatted string showing array contents.
|
Returns a string with the content of the array up to 'entriesToPrint' entries. Includes the index of each entry. Includes the last entry (prints one extra if only one more remains to avoid "...").
|
Full Usage:
fail arr funcAndReason
Parameters:
'T[]
-
The input array.
funcAndReason : string
-
A string describing the function and reason for failure.
Returns: 'a
Never returns (always raises).
|
Raises an ArgumentException with a descriptive message about array operation failure.
|
Full Usage:
getUnCkd i arr
Parameters:
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.
|
Full Usage:
negIdx i len
Parameters:
int
-
The index to convert (can be negative).
len : int
-
The length of the array.
Returns: int
The converted positive index.
Modifiers: inline |
Converts negative indices to positive ones. Correct results from -length up to length-1. e.g.: -1 is last item. (from the release of F# 5 on a negative index can also be done with '^' prefix. E.g. ^0 for the last item)
|
Full Usage:
negIdxLooped i length
Parameters:
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.
|
Full Usage:
nullExn funcName
Parameters:
string
-
The name of the function that received null input.
Returns: 'a
Never returns (always raises).
|
Raises an ArgumentNullException for a null array input.
|
Full Usage:
setUnCkd i v arr
Parameters:
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.
|
Full Usage:
toStringCore ofType arr
Parameters:
'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.
|
Full Usage:
toStringInline arr
Parameters:
'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.
|
ArrayT