Logo ArrayT

Array Module

The main module for functions on Array<'T>. This module provides additional functions to ones from FSharp.Core.Array module.

Functions and values

Function or value Description

asResizeArray arr

Full Usage: asResizeArray arr

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

Returns: ResizeArray<'T> A ResizeArray containing the same elements.
Modifiers: inline
Type parameters: 'T (requires not struct)

an optimized alternative to the

toResizeArray
function for use in Fable (JavaScript). F# Array and ResizeArray are both represented as JavaScript arrays in Fable. So this function does not allocate a new ResizeArray but just casts the Array to a ResizeArray. In .NET runtime a new ResizeArray is still allocated and the elements are copied.

Numeric arrays are optimized as TypedArrays in Fable, so this function only works on reference types.

arr : 'T[]

The input Array.

Returns: ResizeArray<'T>

A ResizeArray containing the same elements.

count arr

Full Usage: count arr

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

Returns: int The number of items in the Array.
Modifiers: inline
Type parameters: 'T

Return the length or count of the collection. Same as Array.length

arr : 'T[]

The input Array.

Returns: int

The number of items in the Array.

countIf predicate arr

Full Usage: countIf predicate arr

Parameters:
    predicate : 'T -> bool - The function to test each element.
    arr : 'T[] - The input Array.

Returns: int The count of items for which the predicate returns true.
Modifiers: inline
Type parameters: 'T

Counts for how many items of the collection the predicate returns true. Same as Array.filter and then Array.length

predicate : 'T -> bool

The function to test each element.

arr : 'T[]

The input Array.

Returns: int

The count of items for which the predicate returns true.

duplicates arr

Full Usage: duplicates arr

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

Returns: 'T[] An array of duplicate elements.
Type parameters: 'T

Returns all elements that exist more than once in Array. Each element that exists more than once is only returned once. The returned item is the second occurrence, where the duplicate is first detected. Returned order is by position of that second occurrence.

arr : 'T[]

The input Array.

Returns: 'T[]

An array of duplicate elements.

duplicatesBy f arr

Full Usage: duplicatesBy f arr

Parameters:
    f : 'T -> 'U - The function to extract comparison value from each element.
    arr : 'T[] - The input Array.

Returns: 'T[] An array of duplicate elements.
Type parameters: 'T, 'U

Returns all elements whose projected value exists more than once in Array. Each projected value that exists more than once is only returned once. The returned item is the second occurrence, where the duplicate is first detected. Returned order is by position of that second occurrence.

f : 'T -> 'U

The function to extract comparison value from each element.

arr : 'T[]

The input Array.

Returns: 'T[]

An array of duplicate elements.

failIfEmpty errorMessage arr

Full Usage: failIfEmpty errorMessage arr

Parameters:
    errorMessage : string - The error message to include in the exception.
    arr : 'T[] - The input Array.

Returns: 'T[] The input Array if not empty.
Modifiers: inline
Type parameters: 'T

Raises an ArrayTArgumentException if the Array is empty. (Useful for chaining) Returns the input Array

errorMessage : string

The error message to include in the exception.

arr : 'T[]

The input Array.

Returns: 'T[]

The input Array if not empty.

failIfLessThan count errorMessage arr

Full Usage: failIfLessThan count errorMessage arr

Parameters:
    count : int - The minimum count required.
    errorMessage : string - The error message to include in the exception.
    arr : 'T[] - The input Array.

Returns: 'T[] The input Array if it has enough items.
Type parameters: 'T

Raises an ArrayTArgumentException if the Array has less then count items. (Useful for chaining) Returns the input Array

count : int

The minimum count required.

errorMessage : string

The error message to include in the exception.

arr : 'T[]

The input Array.

Returns: 'T[]

The input Array if it has enough items.

filteri predicate arr

Full Usage: filteri predicate arr

Parameters:
    predicate : int -> 'T -> bool - The function to test the index and the element.
    arr : 'T[] - The input array.

Returns: 'T[] An array containing the elements for which the given predicate returns true.
Type parameters: 'T

Returns a new collection containing only the elements of the collection for which the given predicate, called with the index and the element, returns true.

predicate : int -> 'T -> bool

The function to test the index and the element.

arr : 'T[]

The input array.

Returns: 'T[]

An array containing the elements for which the given predicate returns true.

findArray searchFor fromIdx tillIdx searchIn

Full Usage: findArray searchFor fromIdx tillIdx searchIn

Parameters:
    searchFor : 'T[] - The array pattern to search for.
    fromIdx : int - The starting index for the search.
    tillIdx : int - The ending index for the search.
    searchIn : 'T[] - The array to search in.

Returns: int The index of the first occurrence, or -1 if not found.
Type parameters: 'T (requires equality)

Find first index where searchFor array occurs in searchIn array. Give lower and upper bound index for search space. Returns index of first element or -1 if not found

searchFor : 'T[]

The array pattern to search for.

fromIdx : int

The starting index for the search.

tillIdx : int

The ending index for the search.

searchIn : 'T[]

The array to search in.

Returns: int

The index of the first occurrence, or -1 if not found.

findIndexi predicate arr

Full Usage: findIndexi predicate arr

Parameters:
    predicate : int -> 'T -> bool - The function to test each indexed element against.
    arr : 'T[] - The input Array.

Returns: int The index of the first element that satisfies the predicate.
Type parameters: 'T

Returns the zero-based index of the first element in the Array that satisfies the given indexed predicate.

predicate : int -> 'T -> bool

The function to test each indexed element against.

arr : 'T[]

The input Array.

Returns: int

The index of the first element that satisfies the predicate.

ArrayTKeyNotFoundException Thrown when no element satisfies the predicate.

findLastArray searchFor fromIdx tillIdx searchIn

Full Usage: findLastArray searchFor fromIdx tillIdx searchIn

Parameters:
    searchFor : 'T[] - The array pattern to search for.
    fromIdx : int - The starting index for the search.
    tillIdx : int - The ending index for the search.
    searchIn : 'T[] - The array to search in.

Returns: int The index of the last occurrence, or -1 if not found.
Type parameters: 'T (requires equality)

Find last index where searchFor array occurs in searchIn array. Searching from end. Give lower and upper bound index for search space. Returns index of first element or -1 if not found

searchFor : 'T[]

The array pattern to search for.

fromIdx : int

The starting index for the search.

tillIdx : int

The ending index for the search.

searchIn : 'T[]

The array to search in.

Returns: int

The index of the last occurrence, or -1 if not found.

findLastValue searchFor fromIdx tillIdx searchIn

Full Usage: findLastValue searchFor fromIdx tillIdx searchIn

Parameters:
    searchFor : 'T - The value to search for.
    fromIdx : int - The starting index for the search.
    tillIdx : int - The ending index for the search.
    searchIn : 'T[] - The array to search in.

Returns: int The index of the last occurrence, or -1 if not found.
Type parameters: 'T (requires equality)

Find last index where searchFor occurs in searchIn array. Searching from end. Give lower and upper bound index for search space. Returns -1 if not found

searchFor : 'T

The value to search for.

fromIdx : int

The starting index for the search.

tillIdx : int

The ending index for the search.

searchIn : 'T[]

The array to search in.

Returns: int

The index of the last occurrence, or -1 if not found.

findValue searchFor fromIdx tillIdx searchIn

Full Usage: findValue searchFor fromIdx tillIdx searchIn

Parameters:
    searchFor : 'T - The value to search for.
    fromIdx : int - The starting index for the search.
    tillIdx : int - The ending index for the search.
    searchIn : 'T[] - The array to search in.

Returns: int The index of the first occurrence, or -1 if not found.
Type parameters: 'T (requires equality)

Find first index where searchFor occurs in searchIn array. Give lower and upper bound index for search space. Returns -1 if not found

searchFor : 'T

The value to search for.

fromIdx : int

The starting index for the search.

tillIdx : int

The ending index for the search.

searchIn : 'T[]

The array to search in.

Returns: int

The index of the first occurrence, or -1 if not found.

first arr

Full Usage: first arr

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

Returns: 'T The first item.
Modifiers: inline
Type parameters: 'T

Gets the first item in the Array. Same as this.[0]

arr : 'T[]

The input Array.

Returns: 'T

The first item.

firstAndOnly arr

Full Usage: firstAndOnly arr

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

Returns: 'T The single item in the Array.
Modifiers: inline
Type parameters: 'T

Gets the only item in the Array. Fails if the Array does not have exactly one element.

arr : 'T[]

The input Array.

Returns: 'T

The single item in the Array.

get index arr

Full Usage: get index arr

Parameters:
    index : int - The input index.
    arr : 'T[] - The input Array.

Returns: 'T The value of the Array at the given index.
Modifiers: inline
Type parameters: 'T

Gets an element from an Array. (Use Array.getNeg(i) function if you want to use negative indices too.)

index : int

The input index.

arr : 'T[]

The input Array.

Returns: 'T

The value of the Array at the given index.

IndexOutOfRangeException Thrown when the index is negative or the input Array does not contain enough elements.

getLooped index arr

Full Usage: getLooped index arr

Parameters:
    index : int - The index to access (can be any integer).
    arr : 'T[] - The input Array.

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

Any index will return a value. Array is treated as an endless loop in positive and negative direction

index : int

The index to access (can be any integer).

arr : 'T[]

The input Array.

Returns: 'T

The value at the looped index.

getNeg index arr

Full Usage: getNeg index arr

Parameters:
    index : int - The index to access (can be negative).
    arr : 'T[] - The input Array.

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

Gets an item in the Array by index. Allows for negative index too ( -1 is last item, like Python) (With LangVersion preview, F# also supports indexing from the end with the '^' prefix, e.g. xs.[^0] for the last item.)

index : int

The index to access (can be negative).

arr : 'T[]

The input Array.

Returns: 'T

The value at the specified index.

groupByDict projection arr

Full Usage: groupByDict projection arr

Parameters:
    projection : 'T -> 'Key - A function that transforms an element of the Array into a key supporting equality. Null and Option.None keys are rejected.
    arr : 'T[] - The input Array.

Returns: Dictionary<'Key, 'T[]> A Dictionary containing each unique key and an Array of its matching elements.
Type parameters: 'T, 'Key (requires equality)

Applies a key-generating function to each element of an Array and yields a Dictionary of unique keys and respective elements that match to this key. Uses F# structural equality for grouping and dictionary lookups on both .NET and Fable. Keys must support equality. Element order within each group is preserved. As opposed to Array.groupBy the key may not be null or Option.None.

projection : 'T -> 'Key

A function that transforms an element of the Array into a key supporting equality. Null and Option.None keys are rejected.

arr : 'T[]

The input Array.

Returns: Dictionary<'Key, 'T[]>

A Dictionary containing each unique key and an Array of its matching elements.

ArrayTArgumentNullException Thrown when the input Array is null or a projected key is null or Option.None.

hasItems count arr

Full Usage: hasItems count arr

Parameters:
    count : int - The exact count to check for.
    arr : 'T[] - The input Array.

Returns: bool True if the Array has exactly the specified count.
Modifiers: inline
Type parameters: 'T

Returns true if the given Array has count items. Unlike the HasItems extension property, this function tests for an exact count.

count : int

The exact count to check for.

arr : 'T[]

The input Array.

Returns: bool

True if the Array has exactly the specified count.

hasMaximumItems count arr

Full Usage: hasMaximumItems count arr

Parameters:
    count : int - The maximum count allowed.
    arr : 'T[] - The input Array.

Returns: bool True if the Array has at most the specified count.
Modifiers: inline
Type parameters: 'T

Returns true if the given Array has equal or less than count items.

count : int

The maximum count allowed.

arr : 'T[]

The input Array.

Returns: bool

True if the Array has at most the specified count.

hasMinimumItems count arr

Full Usage: hasMinimumItems count arr

Parameters:
    count : int - The minimum count required.
    arr : 'T[] - The input Array.

Returns: bool True if the Array has at least the specified count.
Modifiers: inline
Type parameters: 'T

Returns true if the given Array has equal or more than count items.

count : int

The minimum count required.

arr : 'T[]

The input Array.

Returns: bool

True if the Array has at least the specified count.

hasOne arr

Full Usage: hasOne arr

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

Returns: bool True if the Array has exactly one item.
Modifiers: inline
Type parameters: 'T

Returns true if the given Array has just one item. Same as Array.isSingleton

arr : 'T[]

The input Array.

Returns: bool

True if the Array has exactly one item.

headAndTail arr

Full Usage: headAndTail arr

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

Returns: 'T * 'T[] The first element and a new Array with the remaining elements.
Modifiers: inline
Type parameters: 'T

Returns a tuple of the first element of the Array and a new Array containing the remaining elements.

arr : 'T[]

The input Array.

Returns: 'T * 'T[]

The first element and a new Array with the remaining elements.

ArrayTArgumentException Thrown when the input Array is empty.

iPrevThisNext arr

Full Usage: iPrevThisNext arr

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

Returns: (int * 'T * 'T * 'T) seq A sequence of indexed consecutive triples (looped).
Type parameters: 'T

Yields looped Seq from (1, last, first, second) up to (lastIndex, second-last, last, first) The resulting seq has the same element count as the input Array.

arr : 'T[]

The input Array.

Returns: (int * 'T * 'T * 'T) seq

A sequence of indexed consecutive triples (looped).

iThisNext arr

Full Usage: iThisNext arr

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

Returns: (int * 'T * 'T) seq A sequence of indexed consecutive pairs (looped).
Type parameters: 'T

Yields looped Seq from (0,first, second) up to (lastIndex, last, first). The resulting seq has the same element count as the input Array.

arr : 'T[]

The input Array.

Returns: (int * 'T * 'T) seq

A sequence of indexed consecutive pairs (looped).

isNotEmpty arr

Full Usage: isNotEmpty arr

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

Returns: bool True if the Array has at least one item.
Modifiers: inline
Type parameters: 'T

Returns true if the given Array is not empty.

arr : 'T[]

The input Array.

Returns: bool

True if the Array has at least one item.

isSingleton arr

Full Usage: isSingleton arr

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

Returns: bool True if the Array has exactly one item.
Modifiers: inline
Type parameters: 'T

Returns true if the given Array has just one item. Same as Array.hasOne

arr : 'T[]

The input Array.

Returns: bool

True if the Array has exactly one item.

mapIfInputAndResult inputPredicate resultPredicate transform arr

Full Usage: mapIfInputAndResult inputPredicate resultPredicate transform arr

Parameters:
    inputPredicate : 'T[] -> bool - The predicate to test the input array.
    resultPredicate : 'T[] -> bool - The predicate to test the result.
    transform : 'T[] -> 'T[] - The transformation function to apply.
    arr : 'T[] - The input Array.

Returns: 'T[] The transformed array if conditions are met, otherwise the original array.
Modifiers: inline
Type parameters: 'T

Applies a function to array if it meets the inputPredicate, otherwise just returns input. If resulting array meets the resultPredicate it is returned, otherwise original input is returned.

inputPredicate : 'T[] -> bool

The predicate to test the input array.

resultPredicate : 'T[] -> bool

The predicate to test the result.

transform : 'T[] -> 'T[]

The transformation function to apply.

arr : 'T[]

The input Array.

Returns: 'T[]

The transformed array if conditions are met, otherwise the original array.

mapIfResult resultPredicate transform arr

Full Usage: mapIfResult resultPredicate transform arr

Parameters:
    resultPredicate : 'T[] -> bool - The predicate to test the result.
    transform : 'T[] -> 'T[] - The transformation function to apply.
    arr : 'T[] - The input Array.

Returns: 'T[] The transformed array if it meets the predicate, otherwise the original array.
Modifiers: inline
Type parameters: 'T

Applies a function to array If resulting array meets the resultPredicate it is returned, otherwise the original input is returned.

resultPredicate : 'T[] -> bool

The predicate to test the result.

transform : 'T[] -> 'T[]

The transformation function to apply.

arr : 'T[]

The input Array.

Returns: 'T[]

The transformed array if it meets the predicate, otherwise the original array.

mapPrevNext combineAdjacent mergePrevAndNextCombineResults arr

Full Usage: mapPrevNext combineAdjacent mergePrevAndNextCombineResults arr

Parameters:
    combineAdjacent : 'T -> 'T -> 'U - The function to combine two adjacent elements.
    mergePrevAndNextCombineResults : 'T -> 'U -> 'U -> 'V - The function to create the result from the element, its Prev-This and its This-Next combination.
    arr : 'T[] - The input Array.

Returns: 'V[] A new Array with one result per input element.
Type parameters: 'T, 'U, 'V

Treats the Array as a loop. For each element, it gets the Prev-This and the This-Next combination using the combineAdjacent function. Finally creates a new type using itself and the Prev-This and the This-Next combination for each element. The first element uses the last element as previous, and the last element uses the first element as next. On each element it caches the This-Next combination and uses it for the next element as Prev-This.

combineAdjacent : 'T -> 'T -> 'U

The function to combine two adjacent elements.

mergePrevAndNextCombineResults : 'T -> 'U -> 'U -> 'V

The function to create the result from the element, its Prev-This and its This-Next combination.

arr : 'T[]

The input Array.

Returns: 'V[]

A new Array with one result per input element.

matches searchFor atIdx searchIn

Full Usage: matches searchFor atIdx searchIn

Parameters:
    searchFor : 'T[] - The array pattern to search for.
    atIdx : int - The index to start the search.
    searchIn : 'T[] - The array to search in.

Returns: bool True if the pattern matches at the given index.
Type parameters: 'T (requires equality)

Checks if a given array matches the content in Array at a given index

searchFor : 'T[]

The array pattern to search for.

atIdx : int

The index to start the search.

searchIn : 'T[]

The array to search in.

Returns: bool

True if the pattern matches at the given index.

max2 arr

Full Usage: max2 arr

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

Returns: 'T * 'T A tuple of the biggest and second biggest elements.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the biggest and the second biggest element of the Array. If they are equal then the order is kept. NaN is ranked after all other values, so NaN is only returned if there are not enough other values.

arr : 'T[]

The input Array.

Returns: 'T * 'T

A tuple of the biggest and second biggest elements.

max2By f arr

Full Usage: max2By f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: 'T * 'T A tuple of the biggest and second biggest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the biggest and the second biggest element of the Array. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so elements with a NaN key are only returned if there are not enough other elements.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: 'T * 'T

A tuple of the biggest and second biggest elements.

max2IndicesBy f arr

Full Usage: max2IndicesBy f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: int * int A tuple of the indices of the biggest and second biggest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the indices of the biggest and the second biggest element of the Array. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so indices of NaN keys are only returned if there are not enough other keys.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: int * int

A tuple of the indices of the biggest and second biggest elements.

max3 arr

Full Usage: max3 arr

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

Returns: 'T * 'T * 'T A tuple of the three biggest elements.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the biggest three elements of the Array. The first element is the biggest, the second is the second biggest and the third is the third biggest. If they are equal then the order is kept. NaN is ranked after all other values, so NaN is only returned if there are not enough other values.

arr : 'T[]

The input Array.

Returns: 'T * 'T * 'T

A tuple of the three biggest elements.

max3By f arr

Full Usage: max3By f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: 'T * 'T * 'T A tuple of the three biggest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the biggest three elements of the Array. The first element is the biggest, the second is the second biggest and the third is the third biggest. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so elements with a NaN key are only returned if there are not enough other elements.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: 'T * 'T * 'T

A tuple of the three biggest elements.

max3IndicesBy f arr

Full Usage: max3IndicesBy f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: int * int * int A tuple of the indices of the three biggest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the indices of the three biggest elements of the Array. The first element is the index of the biggest, the second is the index of the second biggest and the third is the index of the third biggest. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so indices of NaN keys are only returned if there are not enough other keys.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: int * int * int

A tuple of the indices of the three biggest elements.

maxIndexBy projection arr

Full Usage: maxIndexBy projection arr

Parameters:
    projection : 'T -> 'Key - The function to transform the elements into a type supporting comparison.
    arr : 'T[] - The input Array.

Returns: int The index of the maximum element.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the index of the greatest of all elements of the Array, using generic comparison on the projected keys. NaN keys are ignored: if all keys are NaN, 0 is returned. If several keys are equally great, the index of the first one is returned.

projection : 'T -> 'Key

The function to transform the elements into a type supporting comparison.

arr : 'T[]

The input Array.

Returns: int

The index of the maximum element.

ArrayTArgumentException Thrown when the input Array is empty.

maxNumber arr

Full Usage: maxNumber arr

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

Returns: 'T The maximum element that is not NaN.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the greatest of all elements of the Array, NaN is skipped. NaN is only returned if all elements are NaN. Use Array.max_IEEE754 to propagate NaN instead.

This is the 'maximumNumber' operation of IEEE 754:2019: NaN is skipped and +0.0 is bigger than -0.0. Array.max_IEEE754 is the 'maximum' operation of IEEE 754:2019, it propagates NaN. Both are legitimate, but different operations, see https://github.com/dotnet/fsharp/issues/13207#issuecomment-1194411950 If several elements are equally great, the first one of them is returned.

arr : 'T[]

The input Array.

Returns: 'T

The maximum element that is not NaN.

ArrayTArgumentException Thrown when the input Array is empty.

maxNumberBy projection arr

Full Usage: maxNumberBy projection arr

Parameters:
    projection : 'T -> 'Key - The function to transform the elements into a type supporting comparison.
    arr : 'T[] - The input Array.

Returns: 'T The element with the greatest key that is not NaN, or the first element if all keys are NaN.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the element of the Array with the greatest projected key, NaN keys are skipped. An element with a NaN key is never returned, unless all keys are NaN, then the first element is returned. This also applies to keys that contain NaN, like the tuple (nan, 1). The result does not depend on where NaN keys are in the Array.

This is like Array.maxNumber applied to the keys: NaN keys are skipped, they do not propagate. Array.maxBy from FSharp.Core on .NET instead returns the first element if its key is NaN, but skips NaN keys at all other positions. A NaN key does not propagate like in Array.max_IEEE754, because the returned element would not show that its key was NaN. If several keys are equally great, the first element of them is returned. Unlike in Array.maxNumber, this is also the case for the keys -0.0 and +0.0. If the Array has only one element, the projection is not called. Same as ResizeArray.maxBy in ResizeArrayT.

projection : 'T -> 'Key

The function to transform the elements into a type supporting comparison.

arr : 'T[]

The input Array.

Returns: 'T

The element with the greatest key that is not NaN, or the first element if all keys are NaN.

ArrayTArgumentException Thrown when the input Array is empty.

max_IEEE754 arr

Full Usage: max_IEEE754 arr

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

Returns: 'T The maximum element, or NaN.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the greatest of all elements of the Array. NaN propagates: if any element is NaN, NaN is returned. Use Array.maxNumber to skip NaN instead. Unlike Array.max from FSharp.Core, the result does not depend on where NaN is in the Array.

This is the 'maximum' operation of IEEE 754:2019: NaN propagates and +0.0 is bigger than -0.0. Array.maxNumber is the 'maximumNumber' operation of IEEE 754:2019, it skips NaN. Both are legitimate, but different operations, see https://github.com/dotnet/fsharp/issues/13207#issuecomment-1194411950 If several elements are equally great, the first one of them is returned.

arr : 'T[]

The input Array.

Returns: 'T

The maximum element, or NaN.

ArrayTArgumentException Thrown when the input Array is empty.

min2 arr

Full Usage: min2 arr

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

Returns: 'T * 'T A tuple of the smallest and second smallest elements.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the smallest and the second smallest element of the Array. If they are equal then the order is kept. NaN is ranked after all other values, so NaN is only returned if there are not enough other values.

arr : 'T[]

The input Array.

Returns: 'T * 'T

A tuple of the smallest and second smallest elements.

min2By f arr

Full Usage: min2By f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: 'T * 'T A tuple of the smallest and second smallest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the smallest and the second smallest element of the Array. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so elements with a NaN key are only returned if there are not enough other elements.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: 'T * 'T

A tuple of the smallest and second smallest elements.

min2IndicesBy f arr

Full Usage: min2IndicesBy f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: int * int A tuple of the indices of the smallest and second smallest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the indices of the smallest and the second smallest element of the Array. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so indices of NaN keys are only returned if there are not enough other keys.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: int * int

A tuple of the indices of the smallest and second smallest elements.

min3 arr

Full Usage: min3 arr

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

Returns: 'T * 'T * 'T A tuple of the three smallest elements.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the smallest three elements of the Array. The first element is the smallest, the second is the second smallest and the third is the third smallest. If they are equal then the order is kept. NaN is ranked after all other values, so NaN is only returned if there are not enough other values.

arr : 'T[]

The input Array.

Returns: 'T * 'T * 'T

A tuple of the three smallest elements.

min3By f arr

Full Usage: min3By f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: 'T * 'T * 'T A tuple of the three smallest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the smallest three elements of the Array. The first element is the smallest, the second is the second smallest and the third is the third smallest. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so elements with a NaN key are only returned if there are not enough other elements.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: 'T * 'T * 'T

A tuple of the three smallest elements.

min3IndicesBy f arr

Full Usage: min3IndicesBy f arr

Parameters:
    f : 'T -> 'Key - The function to transform elements for comparison.
    arr : 'T[] - The input Array.

Returns: int * int * int A tuple of the indices of the three smallest elements.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the indices of the three smallest elements of the Array. The first element is the index of the smallest, the second is the index of the second smallest and the third is the index of the third smallest. Elements are compared by applying the predicate function first. If they are equal after function is applied then the order is kept. NaN keys are ranked after all other keys, so indices of NaN keys are only returned if there are not enough other keys.

f : 'T -> 'Key

The function to transform elements for comparison.

arr : 'T[]

The input Array.

Returns: int * int * int

A tuple of the indices of the three smallest elements.

minIndexBy projection arr

Full Usage: minIndexBy projection arr

Parameters:
    projection : 'T -> 'Key - The function to transform the elements into a type supporting comparison.
    arr : 'T[] - The input Array.

Returns: int The index of the smallest element.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the index of the smallest of all elements of the Array, using generic comparison on the projected keys. NaN keys are ignored: if all keys are NaN, 0 is returned. If several keys are equally small, the index of the first one is returned.

projection : 'T -> 'Key

The function to transform the elements into a type supporting comparison.

arr : 'T[]

The input Array.

Returns: int

The index of the smallest element.

ArrayTArgumentException Thrown when the input Array is empty.

minNumber arr

Full Usage: minNumber arr

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

Returns: 'T The minimum element that is not NaN.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the smallest of all elements of the Array, NaN is skipped. NaN is only returned if all elements are NaN. Use Array.min_IEEE754 to propagate NaN instead.

This is the 'minimumNumber' operation of IEEE 754:2019: NaN is skipped and -0.0 is smaller than +0.0. Array.min_IEEE754 is the 'minimum' operation of IEEE 754:2019, it propagates NaN. Both are legitimate, but different operations, see https://github.com/dotnet/fsharp/issues/13207#issuecomment-1194411950 If several elements are equally small, the first one of them is returned.

arr : 'T[]

The input Array.

Returns: 'T

The minimum element that is not NaN.

ArrayTArgumentException Thrown when the input Array is empty.

minNumberBy projection arr

Full Usage: minNumberBy projection arr

Parameters:
    projection : 'T -> 'Key - The function to transform the elements into a type supporting comparison.
    arr : 'T[] - The input Array.

Returns: 'T The element with the smallest key that is not NaN, or the first element if all keys are NaN.
Modifiers: inline
Type parameters: 'T, 'Key (requires comparison)

Returns the element of the Array with the smallest projected key, NaN keys are skipped. An element with a NaN key is never returned, unless all keys are NaN, then the first element is returned. This also applies to keys that contain NaN, like the tuple (nan, 1). The result does not depend on where NaN keys are in the Array.

This is like Array.minNumber applied to the keys: NaN keys are skipped, they do not propagate. Array.minBy from FSharp.Core on .NET instead returns the first element if its key is NaN, but skips NaN keys at all other positions. A NaN key does not propagate like in Array.min_IEEE754, because the returned element would not show that its key was NaN. If several keys are equally small, the first element of them is returned. Unlike in Array.minNumber, this is also the case for the keys -0.0 and +0.0. If the Array has only one element, the projection is not called. Same as ResizeArray.minBy in ResizeArrayT.

projection : 'T -> 'Key

The function to transform the elements into a type supporting comparison.

arr : 'T[]

The input Array.

Returns: 'T

The element with the smallest key that is not NaN, or the first element if all keys are NaN.

ArrayTArgumentException Thrown when the input Array is empty.

min_IEEE754 arr

Full Usage: min_IEEE754 arr

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

Returns: 'T The minimum element, or NaN.
Modifiers: inline
Type parameters: 'T (requires comparison)

Returns the smallest of all elements of the Array. NaN propagates: if any element is NaN, NaN is returned. Use Array.minNumber to skip NaN instead. Unlike Array.min from FSharp.Core, the result does not depend on where NaN is in the Array.

This is the 'minimum' operation of IEEE 754:2019: NaN propagates and -0.0 is smaller than +0.0. Array.minNumber is the 'minimumNumber' operation of IEEE 754:2019, it skips NaN. Both are legitimate, but different operations, see https://github.com/dotnet/fsharp/issues/13207#issuecomment-1194411950 If several elements are equally small, the first one of them is returned.

arr : 'T[]

The input Array.

Returns: 'T

The minimum element, or NaN.

ArrayTArgumentException Thrown when the input Array is empty.

notExists predicate arr

Full Usage: notExists predicate arr

Parameters:
    predicate : 'T -> bool - The function to test the input elements.
    arr : 'T[] - The input Array.

Returns: bool false if any result from predicate is true.
Type parameters: 'T

Tests if none of the elements of the Array satisfies the given predicate. The predicate is applied to the elements of the input Array. If any application returns true then the overall result is false and no further elements are tested. Otherwise, true is returned.

predicate : 'T -> bool

The function to test the input elements.

arr : 'T[]

The input Array.

Returns: bool

false if any result from predicate is true.

ofIList arr

Full Usage: ofIList arr

Parameters:
    arr : IList<'T> - The input IList.

Returns: 'T[] A new array containing the elements from the IList.
Modifiers: inline
Type parameters: 'T

Build a Array from the given IList Interface.

arr : IList<'T>

The input IList.

Returns: 'T[]

A new array containing the elements from the IList.

ofResizeArray rarr

Full Usage: ofResizeArray rarr

Parameters:
    rarr : ResizeArray<'T> - The input ResizeArray.

Returns: 'T[] A new array containing the elements from the ResizeArray.
Modifiers: inline
Type parameters: 'T

Builds a new Array from the given ResizeArray.

rarr : ResizeArray<'T>

The input ResizeArray.

Returns: 'T[]

A new array containing the elements from the ResizeArray.

partition3 predicate1 predicate2 arr

Full Usage: partition3 predicate1 predicate2 arr

Parameters:
    predicate1 : 'T -> bool - The first function to test the input elements.
    predicate2 : 'T -> bool - The second function to test the input elements.
    arr : 'T[] - The input Array.

Returns: 'T[] * 'T[] * 'T[] Three Arrays.
Type parameters: 'T

Splits the collection into three collections, first containing the elements for which the given predicate1 returns true, second containing the elements for which the given predicate2 returns true (and all previous predicates returned false), third the rest.

predicate1 : 'T -> bool

The first function to test the input elements.

predicate2 : 'T -> bool

The second function to test the input elements.

arr : 'T[]

The input Array.

Returns: 'T[] * 'T[] * 'T[]

Three Arrays.

partition3By partitioner arr

Full Usage: partition3By partitioner arr

Parameters:
    partitioner : 'T -> Choice<'U1, 'U2, 'U3> - The function to test the input elements.
    arr : 'T[] - The input Array.

Returns: 'U1[] * 'U2[] * 'U3[] Three Arrays.
Type parameters: 'T, 'U1, 'U2, 'U3

Splits the collection into three collections, containing the elements for which the given function returns Choice1Of3, Choice2Of3 or Choice3Of3, respectively. This function is similar to Array.partition3, but it allows the returned collections to have different element types.

partitioner : 'T -> Choice<'U1, 'U2, 'U3>

The function to test the input elements.

arr : 'T[]

The input Array.

Returns: 'U1[] * 'U2[] * 'U3[]

Three Arrays.

partition4 predicate1 predicate2 predicate3 arr

Full Usage: partition4 predicate1 predicate2 predicate3 arr

Parameters:
    predicate1 : 'T -> bool - The first function to test the input elements.
    predicate2 : 'T -> bool - The second function to test the input elements.
    predicate3 : 'T -> bool - The third function to test the input elements.
    arr : 'T[] - The input Array.

Returns: 'T[] * 'T[] * 'T[] * 'T[] Four Arrays.
Type parameters: 'T

Splits the collection into four collections, first containing the elements for which the given predicate1 returns true, second containing the elements for which the given predicate2 returns true (and all previous predicates returned false), third containing the elements for which the given predicate3 returns true (and all previous predicates returned false), fourth the rest.

predicate1 : 'T -> bool

The first function to test the input elements.

predicate2 : 'T -> bool

The second function to test the input elements.

predicate3 : 'T -> bool

The third function to test the input elements.

arr : 'T[]

The input Array.

Returns: 'T[] * 'T[] * 'T[] * 'T[]

Four Arrays.

partition4By partitioner arr

Full Usage: partition4By partitioner arr

Parameters:
    partitioner : 'T -> Choice<'U1, 'U2, 'U3, 'U4> - The function to test the input elements.
    arr : 'T[] - The input Array.

Returns: 'U1[] * 'U2[] * 'U3[] * 'U4[] Four Arrays.
Type parameters: 'T, 'U1, 'U2, 'U3, 'U4

Splits the collection into four collections, containing the elements for which the given function returns Choice1Of4, Choice2Of4, Choice3Of4 or Choice4Of4, respectively. This function is similar to Array.partition4, but it allows the returned collections to have different element types.

partitioner : 'T -> Choice<'U1, 'U2, 'U3, 'U4>

The function to test the input elements.

arr : 'T[]

The input Array.

Returns: 'U1[] * 'U2[] * 'U3[] * 'U4[]

Four Arrays.

partition5 predicate1 predicate2 predicate3 predicate4 arr

Full Usage: partition5 predicate1 predicate2 predicate3 predicate4 arr

Parameters:
    predicate1 : 'T -> bool - The first function to test the input elements.
    predicate2 : 'T -> bool - The second function to test the input elements.
    predicate3 : 'T -> bool - The third function to test the input elements.
    predicate4 : 'T -> bool - The fourth function to test the input elements.
    arr : 'T[] - The input Array.

Returns: 'T[] * 'T[] * 'T[] * 'T[] * 'T[] Five Arrays.
Type parameters: 'T

Splits the collection into five collections, first containing the elements for which the given predicate1 returns true, second containing the elements for which the given predicate2 returns true (and all previous predicates returned false), third containing the elements for which the given predicate3 returns true (and all previous predicates returned false), fourth containing the elements for which the given predicate4 returns true (and all previous predicates returned false), fifth the rest.

predicate1 : 'T -> bool

The first function to test the input elements.

predicate2 : 'T -> bool

The second function to test the input elements.

predicate3 : 'T -> bool

The third function to test the input elements.

predicate4 : 'T -> bool

The fourth function to test the input elements.

arr : 'T[]

The input Array.

Returns: 'T[] * 'T[] * 'T[] * 'T[] * 'T[]

Five Arrays.

partition5By partitioner arr

Full Usage: partition5By partitioner arr

Parameters:
    partitioner : 'T -> Choice<'U1, 'U2, 'U3, 'U4, 'U5> - The function to test the input elements.
    arr : 'T[] - The input Array.

Returns: 'U1[] * 'U2[] * 'U3[] * 'U4[] * 'U5[] Five Arrays.
Type parameters: 'T, 'U1, 'U2, 'U3, 'U4, 'U5

Splits the collection into five collections, containing the elements for which the given function returns Choice1Of5, Choice2Of5, Choice3Of5, Choice4Of5 or Choice5Of5, respectively. This function is similar to Array.partition5, but it allows the returned collections to have different element types.

partitioner : 'T -> Choice<'U1, 'U2, 'U3, 'U4, 'U5>

The function to test the input elements.

arr : 'T[]

The input Array.

Returns: 'U1[] * 'U2[] * 'U3[] * 'U4[] * 'U5[]

Five Arrays.

partitionBy partitioner arr

Full Usage: partitionBy partitioner arr

Parameters:
    partitioner : 'T -> Choice<'U1, 'U2> - The function to transform and classify each input element into one of two output types.
    arr : 'T[] - The input Array.

Returns: 'U1[] * 'U2[] A tuple of two Arrays. The first containing values from Choice1Of2 results and the second containing values from Choice2Of2 results.
Modifiers: inline
Type parameters: 'T, 'U1, 'U2

Splits the collection into two collections, containing the elements for which the given function returns Choice1Of2 or Choice2Of2, respectively. This function is similar to Array.partition, but it allows the returned collections to have different element types.

partitioner : 'T -> Choice<'U1, 'U2>

The function to transform and classify each input element into one of two output types.

arr : 'T[]

The input Array.

Returns: 'U1[] * 'U2[]

A tuple of two Arrays. The first containing values from Choice1Of2 results and the second containing values from Choice2Of2 results.

partitionWith partitioner arr

Full Usage: partitionWith partitioner arr

Parameters:
    partitioner : 'T -> Choice<'U1, 'U2> - The function to transform and classify each input element into one of two output types.
    arr : 'T[] - The input Array.

Returns: 'U1[] * 'U2[] A tuple of two Arrays. The first containing values from Choice1Of2 results and the second containing values from Choice2Of2 results.
Modifiers: inline
Type parameters: 'T, 'U1, 'U2

Splits the collection into two Arrays, by applying the given partitioning function to each element. Returns Choice1Of2 elements in the first Array and Choice2Of2 elements in the second Array. Element order is preserved in both of the created Arrays. This is the same function as Array.partitionBy, provided under the name used by the F# core Array module since FSharp.Core 10.1.

partitioner : 'T -> Choice<'U1, 'U2>

The function to transform and classify each input element into one of two output types.

arr : 'T[]

The input Array.

Returns: 'U1[] * 'U2[]

A tuple of two Arrays. The first containing values from Choice1Of2 results and the second containing values from Choice2Of2 results.

pickBack chooser arr

Full Usage: pickBack chooser arr

Parameters:
    chooser : 'T -> 'U option - The function to generate options from the elements.
    arr : 'T[] - The input Array.

Returns: 'U The first result. From the end of the Array.
Type parameters: 'T, 'U

Starting from last element going backwards. Applies the given function to successive elements, returning the first result where function returns Some(x) for some x. If the function never returns Some(x) then ArrayTKeyNotFoundException is raised.

chooser : 'T -> 'U option

The function to generate options from the elements.

arr : 'T[]

The input Array.

Returns: 'U

The first result. From the end of the Array.

ArrayTKeyNotFoundException Thrown if every result from chooser is None.

prevThis arr

Full Usage: prevThis arr

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

Returns: ('T * 'T) seq A sequence of consecutive pairs (looped).
Type parameters: 'T

Yields looped Seq from (last,first) up to (second-last, last). The resulting seq has the same element count as the input Array.

arr : 'T[]

The input Array.

Returns: ('T * 'T) seq

A sequence of consecutive pairs (looped).

prevThisNext arr

Full Usage: prevThisNext arr

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

Returns: ('T * 'T * 'T) seq A sequence of consecutive triples (looped).
Type parameters: 'T

Yields looped Seq of from (last, first, second) up to (second-last, last, first). The resulting seq has the same element count as the input Array.

arr : 'T[]

The input Array.

Returns: ('T * 'T * 'T) seq

A sequence of consecutive triples (looped).

rotate amount arr

Full Usage: rotate amount arr

Parameters:
    amount : int - How many elements to shift forward. Or backward if number is negative
    arr : 'T[] - The input Array.

Returns: 'T[] The new result Array.
Modifiers: inline
Type parameters: 'T

Considers array circular and move elements up for positive integers or down for negative integers. e.g.: rotate +1 [ a, b, c, d] = [ d, a, b, c] e.g.: rotate -1 [ a, b, c, d] = [ b, c, d, a] the amount can even be bigger than the array's size. I will just rotate more than one loop.

amount : int

How many elements to shift forward. Or backward if number is negative

arr : 'T[]

The input Array.

Returns: 'T[]

The new result Array.

rotateDownTill condition arr

Full Usage: rotateDownTill condition arr

Parameters:
    condition : 'T -> bool - The condition to meet.
    arr : 'T[] - The input Array.

Returns: 'T[] The new result Array.
Modifiers: inline
Type parameters: 'T

Considers array circular and move elements down till condition is met for the first item. The algorithm takes elements from the start and put them at the end till the first element in the array meets the condition. If the first element in the input meets the condition no changes are made. But still a shallow copy is returned.

condition : 'T -> bool

The condition to meet.

arr : 'T[]

The input Array.

Returns: 'T[]

The new result Array.

rotateDownTillLast condition arr

Full Usage: rotateDownTillLast condition arr

Parameters:
    condition : 'T -> bool - The condition to meet.
    arr : 'T[] - The input Array.

Returns: 'T[] The new result Array.
Modifiers: inline
Type parameters: 'T

Considers array circular and move elements down till condition is met for the last item. The algorithm takes elements from the start and put them at the end till the last element in the array meets the condition. If the last element in the input meets the condition no changes are made. But still a shallow copy is returned.

condition : 'T -> bool

The condition to meet.

arr : 'T[]

The input Array.

Returns: 'T[]

The new result Array.

rotateUpTill condition arr

Full Usage: rotateUpTill condition arr

Parameters:
    condition : 'T -> bool - The condition to meet.
    arr : 'T[] - The input Array.

Returns: 'T[] The new result Array.
Modifiers: inline
Type parameters: 'T

Considers array circular and move elements up till condition is met for the first item. The algorithm takes elements from the end and put them at the start till the first element in the array meets the condition. If the first element in the input meets the condition no changes are made. But still a shallow copy is returned.

condition : 'T -> bool

The condition to meet.

arr : 'T[]

The input Array.

Returns: 'T[]

The new result Array.

rotateUpTillLast condition arr

Full Usage: rotateUpTillLast condition arr

Parameters:
    condition : 'T -> bool - The condition to meet.
    arr : 'T[] - The input Array.

Returns: 'T[] The new result Array.
Modifiers: inline
Type parameters: 'T

Considers array circular and move elements up till condition is met for the last item. The algorithm takes elements from the end and put them at the start till the last element in the array meets the condition. If the last element in the input meets the condition no changes are made. But still a shallow copy is returned.

condition : 'T -> bool

The condition to meet.

arr : 'T[]

The input Array.

Returns: 'T[]

The new result Array.

second arr

Full Usage: second arr

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

Returns: 'T The second item.
Modifiers: inline
Type parameters: 'T

Gets the second item in the Array. Same as this.[1]

arr : 'T[]

The input Array.

Returns: 'T

The second item.

secondLast arr

Full Usage: secondLast arr

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

Returns: 'T The second last item.
Modifiers: inline
Type parameters: 'T

Gets the second last item in the Array. Same as this.[this.Length - 2]

arr : 'T[]

The input Array.

Returns: 'T

The second last item.

set index value arr

Full Usage: set index value arr

Parameters:
    index : int - The input index.
    value : 'T - The input value.
    arr : 'T[] - The input Array.

Modifiers: inline
Type parameters: 'T

Sets an element of a Array. (use Array.setNeg(i) function if you want to use negative indices too)

index : int

The input index.

value : 'T

The input value.

arr : 'T[]

The input Array.

IndexOutOfRangeException Thrown when the index is negative or the input Array does not contain enough elements.

setLooped index value arr

Full Usage: setLooped index value arr

Parameters:
    index : int - The index to set (can be any integer).
    value : 'T - The value to set.
    arr : 'T[] - The input Array.

Modifiers: inline
Type parameters: 'T

Any index will set a value. Array is treated as an endless loop in positive and negative direction

index : int

The index to set (can be any integer).

value : 'T

The value to set.

arr : 'T[]

The input Array.

setNeg index value arr

Full Usage: setNeg index value arr

Parameters:
    index : int - The index to set (can be negative).
    value : 'T - The value to set.
    arr : 'T[] - The input Array.

Modifiers: inline
Type parameters: 'T

Sets an item in the Array by index. Allows for negative index too ( -1 is last item, like Python) (With LangVersion preview, F# also supports indexing from the end with the '^' prefix, e.g. xs.[^0] for the last item.)

index : int

The index to set (can be negative).

value : 'T

The value to set.

arr : 'T[]

The input Array.

singleton value

Full Usage: singleton value

Parameters:
    value : 'T - The input item.

Returns: 'T[] The result Array of one item.
Modifiers: inline
Type parameters: 'T

Returns a Array that contains one item only.

value : 'T

The input item.

Returns: 'T[]

The result Array of one item.

sliceIdx startIdx endIdx arr

Full Usage: sliceIdx startIdx endIdx arr

Parameters:
    startIdx : int - The inclusive start index of the slice.
    endIdx : int - The inclusive end index of the slice.
    arr : 'T[] - The input Array.

Returns: 'T[] A new Array containing the requested range.
Type parameters: 'T

Returns a new Array containing the elements between the specified inclusive start and end indices. This function rejects negative and out-of-bounds indices, while the F# slicing notation xs.[1..3] does not. To allow negative indices use Array.sliceNeg, to normalize any index with modulo use Array.sliceLooped.

startIdx : int

The inclusive start index of the slice.

endIdx : int

The inclusive end index of the slice.

arr : 'T[]

The input Array.

Returns: 'T[]

A new Array containing the requested range.

IndexOutOfRangeException Thrown when either index is outside the Array or startIdx is greater than endIdx.

sliceLooped startIdx endIdx arr

Full Usage: sliceLooped startIdx endIdx arr

Parameters:
    startIdx : int - The inclusive start index to normalize.
    endIdx : int - The inclusive end index to normalize.
    arr : 'T[] - The input Array.

Returns: 'T[] A new Array containing the requested range.
Type parameters: 'T

Returns a new Array containing the elements between the specified start and end indices after normalizing both indices with modulo. Both indices are inclusive, and negative and out-of-range indices are allowed. If the normalized start index is greater than the normalized end index, an empty Array is returned. For an empty input Array, an empty Array is returned.

startIdx : int

The inclusive start index to normalize.

endIdx : int

The inclusive end index to normalize.

arr : 'T[]

The input Array.

Returns: 'T[]

A new Array containing the requested range.

sliceNeg startIdx endIdx arr

Full Usage: sliceNeg startIdx endIdx arr

Parameters:
    startIdx : int - The start index (inclusive, can be negative).
    endIdx : int - The end index (inclusive, can be negative).
    arr : 'T[] - The input Array.

Returns: 'T[] A new array containing the sliced elements.
Type parameters: 'T

Slice the Array given start and end index. Allows for negative indices too. ( -1 is last item, like Python) The resulting Array includes the end index. If the end index is one less than the start index an empty Array is returned. Raises an IndexOutOfRangeException if indices are out of range. If you don't want an exception to be raised for index overflow or overlap use Array.trim. To reject negative indices use Array.sliceIdx, to normalize any index with modulo use Array.sliceLooped. (With LangVersion preview, F# also supports slicing from the end with the '^' prefix, e.g. xs.[1..^1] skips the first and last item.)

startIdx : int

The start index (inclusive, can be negative).

endIdx : int

The end index (inclusive, can be negative).

arr : 'T[]

The input Array.

Returns: 'T[]

A new array containing the sliced elements.

IndexOutOfRangeException Thrown when either index is out of range or the start index is after the end index.

swap i j arr

Full Usage: swap i j arr

Parameters:
    i : int - The first index to swap.
    j : int - The second index to swap.
    arr : 'T[] - The input Array.

Modifiers: inline
Type parameters: 'T

Swap the values of two given indices in Array

i : int

The first index to swap.

j : int

The second index to swap.

arr : 'T[]

The input Array.

third arr

Full Usage: third arr

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

Returns: 'T The third item.
Modifiers: inline
Type parameters: 'T

Gets the third item in the Array. Same as this.[2]

arr : 'T[]

The input Array.

Returns: 'T

The third item.

thirdLast arr

Full Usage: thirdLast arr

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

Returns: 'T The third last item.
Modifiers: inline
Type parameters: 'T

Gets the third last item in the Array. Same as this.[this.Length - 3]

arr : 'T[]

The input Array.

Returns: 'T

The third last item.

thisNext arr

Full Usage: thisNext arr

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

Returns: ('T * 'T) seq A sequence of consecutive pairs (looped).
Type parameters: 'T

Yields looped Seq from (first, second) up to (last, first). The resulting seq has the same element count as the input Array.

arr : 'T[]

The input Array.

Returns: ('T * 'T) seq

A sequence of consecutive pairs (looped).

toResizeArray arr

Full Usage: toResizeArray arr

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

Returns: ResizeArray<'T> A ResizeArray containing a copy of the Array elements.
Modifiers: inline
Type parameters: 'T

Builds a new ResizeArray that contains a copy of the elements of the input Array. This function always allocates a new ResizeArray and copies the elements. (In Fable, Array.asResizeArray avoids the copy for reference types.)

arr : 'T[]

The input Array.

Returns: ResizeArray<'T>

A ResizeArray containing a copy of the Array elements.

trim fromStartCount fromEndCount arr

Full Usage: trim fromStartCount fromEndCount arr

Parameters:
    fromStartCount : int - The number of items to remove from the start.
    fromEndCount : int - The number of items to remove from the end.
    arr : 'T[] - The input Array.

Returns: 'T[] A new trimmed array.
Type parameters: 'T

Trim items from start and end. If the sum of fromStartCount and fromEndCount is equal to or greater than arr.Length, it returns an empty Array. If you want an exception to be raised for index overlap (total trimming is bigger than count) use Array.sliceNeg with a negative end index.

fromStartCount : int

The number of items to remove from the start.

fromEndCount : int

The number of items to remove from the end.

arr : 'T[]

The input Array.

Returns: 'T[]

A new trimmed array.

tryFindIndexi predicate arr

Full Usage: tryFindIndexi predicate arr

Parameters:
    predicate : int -> 'T -> bool - The function to test each indexed element against.
    arr : 'T[] - The input Array.

Returns: int option The index of the first element that satisfies the predicate, or None if not found.
Modifiers: inline
Type parameters: 'T

Returns the zero-based index of the first element in the Array that satisfies the given indexed predicate.

predicate : int -> 'T -> bool

The function to test each indexed element against.

arr : 'T[]

The input Array.

Returns: int option

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

tryPickBack chooser arr

Full Usage: tryPickBack chooser arr

Parameters:
    chooser : 'T -> 'U option - The function to transform the Array elements into options.
    arr : 'T[] - The input Array.

Returns: 'U option The first transformed element searched from the end of the Array that is Some(x).
Type parameters: 'T, 'U

Applies the given function to successive elements from the end of the Array, returning the first result where function returns Some(x) for some x. If the function never returns Some(x) then None is returned.

chooser : 'T -> 'U option

The function to transform the Array elements into options.

arr : 'T[]

The input Array.

Returns: 'U option

The first transformed element searched from the end of the Array that is Some(x).

windowed2 arr

Full Usage: windowed2 arr

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

Returns: ('T * 'T) seq A sequence of consecutive pairs.
Type parameters: 'T

Yields Seq from (first, second) up to (second-last, last). Not looped. The resulting seq is one element shorter than the input Array.

arr : 'T[]

The input Array.

Returns: ('T * 'T) seq

A sequence of consecutive pairs.

windowed2i arr

Full Usage: windowed2i arr

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

Returns: (int * 'T * 'T) seq A sequence of consecutive indexed pairs.
Type parameters: 'T

Yields Seq from (0,first, second) up to (lastIndex-1 , second-last, last). Not looped. The resulting seq is one element shorter than the input Array.

arr : 'T[]

The input Array.

Returns: (int * 'T * 'T) seq

A sequence of consecutive indexed pairs.

windowed3 arr

Full Usage: windowed3 arr

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

Returns: ('T * 'T * 'T) seq A sequence of consecutive triples.
Type parameters: 'T

Yields Seq from (first, second, third) up to (third-last, second-last, last). Not looped. The resulting seq is two elements shorter than the input Array.

arr : 'T[]

The input Array.

Returns: ('T * 'T * 'T) seq

A sequence of consecutive triples.

windowed3i arr

Full Usage: windowed3i arr

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

Returns: (int * 'T * 'T * 'T) seq A sequence of consecutive indexed triples.
Type parameters: 'T

Yields Seq from (1, first, second, third) up to (lastIndex-1 , third-last, second-last, last). Not looped. The resulting seq is two elements shorter than the input Array.

arr : 'T[]

The input Array.

Returns: (int * 'T * 'T * 'T) seq

A sequence of consecutive indexed triples.

zeroCreateUndef len

Full Usage: zeroCreateUndef len

Parameters:
    len : int - The length of the array to create.

Returns: 'T[] The new array.
Modifiers: inline
Type parameters: 'T (requires not struct)

Just Array.zeroCreate in .NET. In Fable, when the `UNCHECKED` symbol is defined, it emits `new Array(len)` without filling the array with the default value of the items. So the items are `undefined` in JavaScript until they are set. Only for reference types, Fable emits TypedArrays for numeric arrays.

len : int

The length of the array to create.

Returns: 'T[]

The new array.

zipDefault getDefaultVal arr1 arr2

Full Usage: zipDefault getDefaultVal arr1 arr2

Parameters:
    getDefaultVal : int -> 'T -> 'T - A function that takes the current index and the current value of the longer Array and returns a default value for the shorter Array.
    arr1 : 'T[] - The first input Array.
    arr2 : 'T[] - The second input Array.

Returns: ('T * 'T)[] The Array of tupled elements, as long as the longer input Array.
Type parameters: 'T

Like Array.zip, but when one of the two input Arrays is exhausted, the getDefaultVal function is used for the rest of the output.

getDefaultVal : int -> 'T -> 'T

A function that takes the current index and the current value of the longer Array and returns a default value for the shorter Array.

arr1 : 'T[]

The first input Array.

arr2 : 'T[]

The second input Array.

Returns: ('T * 'T)[]

The Array of tupled elements, as long as the longer input Array.

Type something to start searching.