Contains operations for working with arrays.
See also F# Language Guide - Arrays.
Function or value | Description | ||||||
Full Usage:
Array.allPairs array1 array2
Parameters:
'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
Returns: ('T1 * 'T2)[]
The resulting array of pairs.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns a new array that contains all pairings of elements from the first and second arrays.
|
||||||
Full Usage:
Array.append array1 array2
Parameters:
'T[]
-
The first input array.
array2 : 'T[]
-
The second input array.
Returns: 'T[]
The resulting array.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array that contains the elements of the first array followed by the elements of the second array.
|
||||||
Full Usage:
Array.average array
Parameters:
^T[]
-
The input array.
Returns: ^T
The average of the elements in the array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the average of the elements in the array.
|
||||||
Full Usage:
Array.averageBy projection array
Parameters:
'T -> ^U
-
The function to transform the array elements before averaging.
array : 'T[]
-
The input array.
Returns: ^U
The computed average.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the average of the elements generated by applying the function to each element of the array.
|
||||||
Full Usage:
Array.blit source sourceIndex target targetIndex count
Parameters:
'T[]
-
The source array.
sourceIndex : int
-
The starting index of the source array.
target : 'T[]
-
The target array.
targetIndex : int
-
The starting index of the target array.
count : int
-
The number of elements to copy.
|
![]() ![]() ![]() ![]() ![]() ![]() Reads a range of elements from the first array and write them into the second.
|
||||||
Full Usage:
Array.choose chooser array
Parameters:
'T -> 'U option
-
The function to generate options from the elements.
array : 'T[]
-
The input array.
Returns: 'U[]
The array of results.
|
![]() ![]() ![]() ![]() ![]() ![]() Applies the given function to each element of the array. Returns the array comprised of the results "x" for each element where the function returns Some(x)
|
||||||
Full Usage:
Array.chunkBySize chunkSize array
Parameters:
int
-
The maximum size of each chunk.
array : 'T[]
-
The input array.
Returns: 'T[][]
The array divided into chunks.
|
![]() ![]() ![]() ![]() ![]() ![]()
Divides the input array into chunks of size at most
|
||||||
Full Usage:
Array.collect mapping array
Parameters:
'T -> 'U[]
-
The function to create sub-arrays from the input array elements.
array : 'T[]
-
The input array.
Returns: 'U[]
The concatenation of the sub-arrays.
|
![]() ![]() ![]() ![]() ![]() ![]() For each element of the array, applies the given function. Concatenates all the results and return the combined array.
|
||||||
Full Usage:
Array.compareWith comparer array1 array2
Parameters:
'T -> 'T -> int
-
A function that takes an element from each array and returns an int.
If it evaluates to a non-zero value iteration is stopped and that value is returned.
array1 : 'T[]
-
The first input array.
array2 : 'T[]
-
The second input array.
Returns: int
Returns the first non-zero result from the comparison function. If the first array has
a larger element, the return value is always positive. If the second array has a larger
element, the return value is always negative. When the elements are equal in the two
arrays, 1 is returned if the first array is longer, 0 is returned if they are equal in
length, and -1 is returned when the second array is longer.
|
![]() ![]() ![]() ![]() ![]() ![]() Compares two arrays using the given comparison function, element by element.
|
||||||
Full Usage:
Array.concat arrays
Parameters:
seq<'T[]>
-
The input sequence of arrays.
Returns: 'T[]
The concatenation of the sequence of input arrays.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array that contains the elements of each of the given sequence of arrays.
|
||||||
Full Usage:
Array.contains value array
Parameters:
'T
-
The value to locate in the input array.
array : 'T[]
-
The input array.
Returns: bool
True if the input array contains the specified element; false otherwise.
|
![]() ![]() ![]() ![]() ![]() ![]() Tests if the array contains the specified element.
|
||||||
Full Usage:
Array.copy array
Parameters:
'T[]
-
The input array.
Returns: 'T[]
A copy of the input array.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array that contains the elements of the given array.
|
||||||
Full Usage:
Array.countBy projection array
Parameters:
'T -> 'Key
-
A function transforming each item of the input array into a key to be
compared against the others.
array : 'T[]
-
The input array.
Returns: ('Key * int)[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Applies a key-generating function to each element of an array and returns an array yielding unique keys and their number of occurrences in the original array.
|
||||||
Full Usage:
Array.create count value
Parameters:
int
-
The length of the array to create.
value : 'T
-
The value for the elements.
Returns: 'T[]
The created array.
|
![]() ![]() ![]() ![]() ![]() ![]() Creates an array whose elements are all initially the given value.
|
||||||
Full Usage:
Array.distinct array
Parameters:
'T[]
-
The input array.
Returns: 'T[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an array that contains no duplicate entries according to generic hash and equality comparisons on the entries. If an element occurs multiple times in the array then the later occurrences are discarded.
|
||||||
Full Usage:
Array.distinctBy projection array
Parameters:
'T -> 'Key
-
A function transforming the array items into comparable keys.
array : 'T[]
-
The input array.
Returns: 'T[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an array that contains no duplicate entries according to the generic hash and equality comparisons on the keys returned by the given key-generating function. If an element occurs multiple times in the array then the later occurrences are discarded.
|
||||||
Full Usage:
Array.empty
Returns: 'T[]
The empty array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an empty array of the given type.
|
||||||
Full Usage:
Array.exactlyOne array
Parameters:
'T[]
-
The input array.
Returns: 'T
The only element of the array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the only element of the array.
|
||||||
Full Usage:
Array.except itemsToExclude array
Parameters:
seq<'T>
-
A sequence whose elements that also occur in the input array will cause those elements to be
removed from the result.
array : 'T[]
-
An array whose elements that are not also in itemsToExclude will be returned.
Returns: 'T[]
An array that contains the distinct elements of array that do not appear in itemsToExclude .
|
![]() ![]() ![]() ![]() ![]() ![]() Returns a new list with the distinct elements of the input array which do not appear in the itemsToExclude sequence, using generic hash and equality comparisons to compare values.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Tests if any element 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 true and no further elements are tested. Otherwise, false is returned.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Tests if any pair of corresponding elements of the arrays satisfies the given predicate.
The predicate is applied to matching elements in the two collections up to the lesser of the
two lengths of the collections. If any application returns true then the overall result is
true and no further elements are tested. Otherwise, if one collections is longer
than the other then the
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Fills a range of elements of the array with the given value.
|
||||||
Full Usage:
Array.filter predicate array
Parameters:
'T -> bool
-
The function to test the input elements.
array : 'T[]
-
The input array.
Returns: 'T[]
An array containing the elements for which the given predicate returns true.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns a new collection containing only the elements of the collection for which the given predicate returns "true".
|
||||||
Full Usage:
Array.find predicate array
Parameters:
'T -> bool
-
The function to test the input elements.
array : 'T[]
-
The input array.
Returns: 'T
The first element for which predicate returns true.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the first element for which the given function returns 'true'. Raise KeyNotFoundException if no such element exists.
|
||||||
Full Usage:
Array.findBack predicate array
Parameters:
'T -> bool
-
The function to test the input elements.
array : 'T[]
-
The input array.
Returns: 'T
The last element for which predicate returns true.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the last element for which the given function returns 'true'. Raise KeyNotFoundException if no such element exists.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the index of the first element in the array that satisfies the given predicate. Raise KeyNotFoundException if none of the elements satisfy the predicate.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the index of the last element in the array that satisfies the given predicate. Raise KeyNotFoundException if none of the elements satisfy the predicate.
|
||||||
Full Usage:
Array.fold folder state array
Parameters:
'State -> 'T -> 'State
-
The function to update the state given the input elements.
state : 'State
-
The initial state.
array : 'T[]
-
The input array.
Returns: 'State
The final state.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies a function to each element of the collection, threading an accumulator argument
through the computation. If the input function is
|
||||||
Full Usage:
Array.fold2 folder state array1 array2
Parameters:
'State -> 'T1 -> 'T2 -> 'State
-
The function to update the state given the input elements.
state : 'State
-
The initial state.
array1 : 'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
Returns: 'State
The final state.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies a function to pairs of elements drawn from the two collections,
left-to-right, threading an accumulator argument
through the computation. The two input
arrays must have the same lengths, otherwise an
|
||||||
Full Usage:
Array.foldBack folder array state
Parameters:
'T -> 'State -> 'State
-
The function to update the state given the input elements.
array : 'T[]
-
The input array.
state : 'State
-
The initial state.
Returns: 'State
The state object after the folding function is applied to each element of the array.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies a function to each element of the array, starting from the end, threading an accumulator argument
through the computation. If the input function is
|
||||||
Full Usage:
Array.foldBack2 folder array1 array2 state
Parameters:
'T1 -> 'T2 -> 'State -> 'State
-
The function to update the state given the input elements.
array1 : 'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
state : 'State
-
The initial state.
Returns: 'State
The final state.
|
![]() ![]() ![]() ![]() ![]() ![]()
Apply a function to pairs of elements drawn from the two collections, right-to-left,
threading an accumulator argument through the computation. The two input
arrays must have the same lengths, otherwise an
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Tests if all elements of the array satisfy the given predicate. The predicate is applied to the elements of the input collection. If any application returns false then the overall result is false and no further elements are tested. Otherwise, true is returned.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Tests if all corresponding elements of the array satisfy the given predicate pairwise.
The predicate is applied to matching elements in the two collections up to the lesser of the
two lengths of the collections. If any application returns false then the overall result is
false and no further elements are tested. Otherwise, if one collection is longer
than the other then the
|
||||||
Full Usage:
Array.get array index
Parameters:
'T[]
-
The input array.
index : int
-
The input index.
Returns: 'T
The value of the array at the given index.
|
![]() ![]() ![]() ![]() ![]() ![]() Gets an element from an array.
|
||||||
Full Usage:
Array.groupBy projection array
Parameters:
'T -> 'Key
-
A function that transforms an element of the array into a comparable key.
array : 'T[]
-
The input array.
Returns: ('Key * 'T[])[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Applies a key-generating function to each element of an array and yields an array of unique keys. Each unique key contains an array of all elements that match to this key.
|
||||||
Full Usage:
Array.head array
Parameters:
'T[]
-
The input array.
Returns: 'T
The first element of the array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the first element of the array.
|
||||||
Full Usage:
Array.indexed array
Parameters:
'T[]
-
The input array.
Returns: (int * 'T)[]
The array of indexed elements.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array whose elements are the corresponding elements of the input array paired with the integer index (from 0) of each element.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Creates an array given the dimension and a generator function to compute the elements.
|
||||||
Full Usage:
Array.isEmpty array
Parameters:
'T[]
-
The input array.
Returns: bool
True if the array is empty.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns true if the given array is empty, otherwise false.
|
||||||
Full Usage:
Array.item index array
Parameters:
int
-
The input index.
array : 'T[]
-
The input array.
Returns: 'T
The value of the array at the given index.
|
![]() ![]() ![]() ![]() ![]() ![]() Gets an element from an array.
|
||||||
Full Usage:
Array.iter action array
Parameters:
'T -> unit
-
The function to apply.
array : 'T[]
-
The input array.
|
![]() ![]() ![]() ![]() ![]() ![]() Applies the given function to each element of the array.
|
||||||
Full Usage:
Array.iter2 action array1 array2
Parameters:
'T1 -> 'T2 -> unit
-
The function to apply.
array1 : 'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies the given function to pair of elements drawn from matching indices in two arrays. The
two arrays must have the same lengths, otherwise an
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Applies the given function to each element of the array. The integer passed to the function indicates the index of element.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies the given function to pair of elements drawn from matching indices in two arrays,
also passing the index of the elements. The two arrays must have the same lengths,
otherwise an
|
||||||
Full Usage:
Array.last array
Parameters:
'T[]
-
The input array.
Returns: 'T
The last element of the array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the last element of the array.
|
||||||
Full Usage:
Array.length array
Parameters:
'T[]
-
The input array.
Returns: int
The length of the array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the length of an array. You can also use property arr.Length.
|
||||||
Full Usage:
Array.map mapping array
Parameters:
'T -> 'U
-
The function to transform elements of the array.
array : 'T[]
-
The input array.
Returns: 'U[]
The array of transformed elements.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array whose elements are the results of applying the given function to each of the elements of the array.
|
||||||
Full Usage:
Array.map2 mapping array1 array2
Parameters:
'T1 -> 'T2 -> 'U
-
The function to transform the pairs of the input elements.
array1 : 'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
Returns: 'U[]
The array of transformed elements.
|
![]() ![]() ![]() ![]() ![]() ![]()
Builds a new collection whose elements are the results of applying the given function
to the corresponding elements of the two collections pairwise. The two input
arrays must have the same lengths, otherwise an
|
||||||
Full Usage:
Array.map3 mapping array1 array2 array3
Parameters:
'T1 -> 'T2 -> 'T3 -> 'U
-
The function to transform the pairs of the input elements.
array1 : 'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
array3 : 'T3[]
-
The third input array.
Returns: 'U[]
The array of transformed elements.
|
![]() ![]() ![]() ![]() ![]() ![]()
Builds a new collection whose elements are the results of applying the given function
to the corresponding triples from the three collections. The three input
arrays must have the same length, otherwise an
|
||||||
Full Usage:
Array.mapFold mapping state array
Parameters:
'State -> 'T -> 'Result * 'State
-
The function to transform elements from the input array and accumulate the final value.
state : 'State
-
The initial state.
array : 'T[]
-
The input array.
Returns: 'Result[] * 'State
The array of transformed elements, and the final accumulated value.
|
![]() ![]() ![]() ![]() ![]() ![]() Combines map and fold. Builds a new array whose elements are the results of applying the given function to each of the elements of the input array. The function is also used to accumulate a final value.
|
||||||
Full Usage:
Array.mapFoldBack mapping array state
Parameters:
'T -> 'State -> 'Result * 'State
-
The function to transform elements from the input array and accumulate the final value.
array : 'T[]
-
The input array.
state : 'State
-
The initial state.
Returns: 'Result[] * 'State
The array of transformed elements, and the final accumulated value.
|
![]() ![]() ![]() ![]() ![]() ![]() Combines map and foldBack. Builds a new array whose elements are the results of applying the given function to each of the elements of the input array. The function is also used to accumulate a final value.
|
||||||
Full Usage:
Array.mapi mapping array
Parameters:
int -> 'T -> 'U
-
The function to transform elements and their indices.
array : 'T[]
-
The input array.
Returns: 'U[]
The array of transformed elements.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array whose elements are the results of applying the given function to each of the elements of the array. The integer index passed to the function indicates the index of element being transformed.
|
||||||
Full Usage:
Array.mapi2 mapping array1 array2
Parameters:
int -> 'T1 -> 'T2 -> 'U
-
The function to transform pairs of input elements and their indices.
array1 : 'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
Returns: 'U[]
The array of transformed elements.
|
![]() ![]() ![]() ![]() ![]() ![]()
Builds a new collection whose elements are the results of applying the given function
to the corresponding elements of the two collections pairwise, also passing the index of
the elements. The two input arrays must have the same lengths, otherwise an
|
||||||
Full Usage:
Array.max array
Parameters:
'T[]
-
The input array.
Returns: 'T
The maximum element.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the greatest of all elements of the array, compared via Operators.max on the function result. Throws ArgumentException for empty arrays.
|
||||||
Full Usage:
Array.maxBy projection array
Parameters:
'T -> 'U
-
The function to transform the elements into a type supporting comparison.
array : 'T[]
-
The input array.
Returns: 'T
The maximum element.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the greatest of all elements of the array, compared via Operators.max on the function result. Throws ArgumentException for empty arrays.
|
||||||
Full Usage:
Array.min array
Parameters:
'T[]
-
The input array.
Returns: 'T
The minimum element.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the lowest of all elements of the array, compared via Operators.min. Throws ArgumentException for empty arrays
|
||||||
Full Usage:
Array.minBy projection array
Parameters:
'T -> 'U
-
The function to transform the elements into a type supporting comparison.
array : 'T[]
-
The input array.
Returns: 'T
The minimum element.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the lowest of all elements of the array, compared via Operators.min on the function result. Throws ArgumentException for empty arrays.
|
||||||
Full Usage:
Array.ofList list
Parameters:
'T list
-
The input list.
Returns: 'T[]
The array of elements from the list.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds an array from the given list.
|
||||||
Full Usage:
Array.ofSeq source
Parameters:
seq<'T>
-
The input sequence.
Returns: 'T[]
The array of elements from the sequence.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array from the given enumerable object.
|
||||||
Full Usage:
Array.pairwise array
Parameters:
'T[]
-
The input array.
Returns: ('T * 'T)[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an array of each element in the input array and its predecessor, with the exception of the first element which is only returned as the predecessor of the second element.
|
||||||
Full Usage:
Array.partition predicate array
Parameters:
'T -> bool
-
The function to test the input elements.
array : 'T[]
-
The input array.
Returns: 'T[] * 'T[]
A pair of arrays. The first containing the elements the predicate evaluated to true,
and the second containing those evaluated to false.
|
![]() ![]() ![]() ![]() ![]() ![]() Splits the collection into two collections, containing the elements for which the given predicate returns "true" and "false" respectively.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an array with all elements permuted according to the specified permutation.
|
||||||
Full Usage:
Array.pick chooser array
Parameters:
'T -> 'U option
-
The function to generate options from the elements.
array : 'T[]
-
The input array.
Returns: 'U
The first result.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies the given function to successive elements, returning the first
result where function returns
|
||||||
Full Usage:
Array.reduce reduction array
Parameters:
'T -> 'T -> 'T
-
The function to reduce a pair of elements to a single element.
array : 'T[]
-
The input array.
Returns: 'T
The final result of the reductions.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies a function to each element of the array, threading an accumulator argument
through the computation. If the input function is
|
||||||
Full Usage:
Array.reduceBack reduction array
Parameters:
'T -> 'T -> 'T
-
A function that takes in the next-to-last element of the list and the
current accumulated result to produce the next accumulated result.
array : 'T[]
-
The input array.
Returns: 'T
The final result of the reductions.
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies a function to each element of the array, starting from the end, threading an accumulator argument
through the computation. If the input function is
|
||||||
Full Usage:
Array.replicate count initial
Parameters:
int
-
The number of elements to replicate.
initial : 'T
-
The value to replicate
Returns: 'T[]
The generated array.
|
![]() ![]() ![]() ![]() ![]() ![]() Creates an array by replicating the given initial value.
|
||||||
Full Usage:
Array.rev array
Parameters:
'T[]
-
The input array.
Returns: 'T[]
The reversed array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns a new array with the elements in reverse order.
|
||||||
Full Usage:
Array.scan folder state array
Parameters:
'State -> 'T -> 'State
-
The function to update the state given the input elements.
state : 'State
-
The initial state.
array : 'T[]
-
The input array.
Returns: 'State[]
The array of state values.
|
![]() ![]() ![]() ![]() ![]() ![]()
Like
|
||||||
Full Usage:
Array.scanBack folder array state
Parameters:
'T -> 'State -> 'State
-
The function to update the state given the input elements.
array : 'T[]
-
The input array.
state : 'State
-
The initial state.
Returns: 'State[]
The array of state values.
|
![]() ![]() ![]() ![]() ![]() ![]()
Like
|
||||||
Full Usage:
Array.set array index value
Parameters:
'T[]
-
The input array.
index : int
-
The input index.
value : 'T
-
The input value.
|
![]() ![]() ![]() ![]() ![]() ![]() Sets an element of an array.
|
||||||
Full Usage:
Array.singleton value
Parameters:
'T
-
The input item.
Returns: 'T[]
The result array of one item.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an array that contains one item only.
|
||||||
Full Usage:
Array.skip count array
Parameters:
int
-
The number of elements to skip.
array : 'T[]
-
The input array.
Returns: 'T[]
A copy of the input array, after removing the first N elements.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array that contains the elements of the given array, excluding the first N elements.
|
||||||
Full Usage:
Array.skipWhile predicate array
Parameters:
'T -> bool
-
A function that evaluates an element of the array to a boolean value.
array : 'T[]
-
The input array.
Returns: 'T[]
The created sub array.
|
![]() ![]() ![]() ![]() ![]() ![]() Bypasses elements in an array while the given predicate returns True, and then returns the remaining elements in a new array.
|
||||||
Full Usage:
Array.sort array
Parameters:
'T[]
-
The input array.
Returns: 'T[]
The sorted array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array, returning a new array. Elements are compared using Operators.compare. This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. For a stable sort, consider using Seq.Sort.
|
||||||
Full Usage:
Array.sortBy projection array
Parameters:
'T -> 'Key
-
The function to transform array elements into the type that is compared.
array : 'T[]
-
The input array.
Returns: 'T[]
The sorted array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array, using the given projection for the keys and returning a new array. Elements are compared using Operators.compare. This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. For a stable sort, consider using Seq.Sort.
|
||||||
Full Usage:
Array.sortByDescending projection array
Parameters:
'T -> 'Key
-
The function to transform array elements into the type that is compared.
array : 'T[]
-
The input array.
Returns: 'T[]
The sorted array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array. Elements are compared using Operators.compare. This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. For a stable sort, consider using Seq.Sort.
|
||||||
Full Usage:
Array.sortDescending array
Parameters:
'T[]
-
The input array.
Returns: 'T[]
The sorted array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array, in descending order, returning a new array. Elements are compared using Operators.compare. This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. For a stable sort, consider using Seq.Sort.
|
||||||
Full Usage:
Array.sortInPlace array
Parameters:
'T[]
-
The input array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array by mutating the array in-place, using the given comparison function. Elements are compared using Operators.compare.
|
||||||
Full Usage:
Array.sortInPlaceBy projection array
Parameters:
'T -> 'Key
-
The function to transform array elements into the type that is compared.
array : 'T[]
-
The input array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array by mutating the array in-place, using the given projection for the keys. Elements are compared using Operators.compare. This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. For a stable sort, consider using Seq.Sort.
|
||||||
Full Usage:
Array.sortInPlaceWith comparer array
Parameters:
'T -> 'T -> int
-
The function to compare pairs of array elements.
array : 'T[]
-
The input array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array by mutating the array in-place, using the given comparison function as the order.
|
||||||
Full Usage:
Array.sortWith comparer array
Parameters:
'T -> 'T -> int
-
The function to compare pairs of array elements.
array : 'T[]
-
The input array.
Returns: 'T[]
The sorted array.
|
![]() ![]() ![]() ![]() ![]() ![]() Sorts the elements of an array, using the given comparison function as the order, returning a new array. This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved. For a stable sort, consider using Seq.Sort.
|
||||||
Full Usage:
Array.splitAt index array
Parameters:
int
-
The index at which the array is split.
array : 'T[]
-
The input array.
Returns: 'T[] * 'T[]
The two split arrays.
|
![]() ![]() ![]() ![]() ![]() ![]() Splits an array into two arrays, at the given index.
|
||||||
Full Usage:
Array.splitInto count array
Parameters:
int
-
The maximum number of chunks.
array : 'T[]
-
The input array.
Returns: 'T[][]
The array split into chunks.
|
![]() ![]() ![]() ![]() ![]() ![]()
Splits the input array into at most
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a new array that contains the given subrange specified by starting index and length.
|
||||||
Full Usage:
Array.sum array
Parameters:
^T[]
-
The input array.
Returns: ^T
The resulting sum.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the sum of the elements in the array.
|
||||||
Full Usage:
Array.sumBy projection array
Parameters:
'T -> ^U
-
The function to transform the array elements into the type to be summed.
array : 'T[]
-
The input array.
Returns: ^U
The resulting sum.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the sum of the results generated by applying the function to each element of the array.
|
||||||
Full Usage:
Array.tail array
Parameters:
'T[]
-
The input array.
Returns: 'T[]
A new array containing the elements of the original except the first element.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns a new array containing the elements of the original except the first element.
|
||||||
Full Usage:
Array.take count array
Parameters:
int
-
The number of items to take.
array : 'T[]
-
The input array.
Returns: 'T[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the first N elements of the array.
Throws
|
||||||
Full Usage:
Array.takeWhile predicate array
Parameters:
'T -> bool
-
A function that evaluates to false when no more items should be returned.
array : 'T[]
-
The input array.
Returns: 'T[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an array that contains all elements of the original array while the given predicate returns True, and then returns no further elements.
|
||||||
Full Usage:
Array.toList array
Parameters:
'T[]
-
The input array.
Returns: 'T list
The list of array elements.
|
![]() ![]() ![]() ![]() ![]() ![]() Builds a list from the given array.
|
||||||
Full Usage:
Array.toSeq array
Parameters:
'T[]
-
The input array.
Returns: seq<'T>
The sequence of array elements.
|
![]() ![]() ![]() ![]() ![]() ![]() Views the given array as a sequence.
|
||||||
Full Usage:
Array.transpose arrays
Parameters:
seq<'T[]>
-
The input sequence of arrays.
Returns: 'T[][]
The transposed array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the transpose of the given sequence of arrays.
|
||||||
Full Usage:
Array.truncate count array
Parameters:
int
-
The maximum number of items to return.
array : 'T[]
-
The input array.
Returns: 'T[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns at most N elements in a new array.
|
||||||
Full Usage:
Array.tryExactlyOne array
Parameters:
'T[]
-
The input array.
Returns: 'T option
The only element of the array or None.
|
![]() ![]() ![]() ![]() ![]() ![]()
Returns the only element of the array or
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the first element for which the given function returns True. Return None if no such element exists.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the last element for which the given function returns True. Return None if no such element exists.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the index of the first element in the array that satisfies the given predicate.
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]() Returns the index of the last element in the array that satisfies the given predicate.
|
||||||
Full Usage:
Array.tryHead array
Parameters:
'T[]
-
The input array.
Returns: 'T option
The first element of the array or None.
|
![]() ![]() ![]() ![]() ![]() ![]()
Returns the first element of the array, or
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]()
Tries to find the nth element in the array.
Returns
|
||||||
Full Usage:
Array.tryLast array
Parameters:
'T[]
-
The input array.
Returns: 'T option
The last element of the array or None.
|
![]() ![]() ![]() ![]() ![]() ![]()
Returns the last element of the array.
Return
|
||||||
|
![]() ![]() ![]() ![]() ![]() ![]()
Applies the given function to successive elements, returning the first
result where function returns
|
||||||
Full Usage:
Array.unfold generator state
Parameters:
'State -> ('T * 'State) option
-
A function that takes in the current state and returns an option tuple of the next
element of the array and the next state value.
state : 'State
-
The initial state value.
Returns: 'T[]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]()
Returns an array that contains the elements generated by the given computation.
The given initial
|
||||||
Full Usage:
Array.unzip array
Parameters:
('T1 * 'T2)[]
-
The input array.
Returns: 'T1[] * 'T2[]
The two arrays.
|
![]() ![]() ![]() ![]() ![]() ![]() Splits an array of pairs into two arrays.
|
||||||
Full Usage:
Array.unzip3 array
Parameters:
('T1 * 'T2 * 'T3)[]
-
The input array.
Returns: 'T1[] * 'T2[] * 'T3[]
The tuple of three arrays.
|
![]() ![]() ![]() ![]() ![]() ![]() Splits an array of triples into three arrays.
|
||||||
Full Usage:
Array.where predicate array
Parameters:
'T -> bool
-
The function to test the input elements.
array : 'T[]
-
The input array.
Returns: 'T[]
An array containing the elements for which the given predicate returns true.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns a new array containing only the elements of the array for which the given predicate returns "true".
|
||||||
Full Usage:
Array.windowed windowSize array
Parameters:
int
-
The number of elements in each window.
array : 'T[]
-
The input array.
Returns: 'T[][]
The result array.
|
![]() ![]() ![]() ![]() ![]() ![]() Returns an array of sliding windows containing elements drawn from the input array. Each window is returned as a fresh array.
|
||||||
Full Usage:
Array.zeroCreate count
Parameters:
int
-
The length of the array to create.
Returns: 'T[]
The created array.
|
![]() ![]() ![]() ![]() ![]() ![]() Creates an array where the entries are initially the default value Unchecked.defaultof<'T>.
|
||||||
Full Usage:
Array.zip array1 array2
Parameters:
'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
Returns: ('T1 * 'T2)[]
The array of tupled elements.
|
![]() ![]() ![]() ![]() ![]() ![]()
Combines the two arrays into an array of pairs. The two arrays must have equal lengths, otherwise an
|
||||||
Full Usage:
Array.zip3 array1 array2 array3
Parameters:
'T1[]
-
The first input array.
array2 : 'T2[]
-
The second input array.
array3 : 'T3[]
-
The third input array.
Returns: ('T1 * 'T2 * 'T3)[]
The array of tupled elements.
|
![]() ![]() ![]() ![]() ![]() ![]()
Combines three arrays into an array of pairs. The three arrays must have equal lengths, otherwise an
|