MappedByIndex function
Fully qualified name: Std.Arrays.MappedByIndex
function MappedByIndex<'T, 'U>(mapper : ((Int, 'T) -> 'U), array : 'T[]) : 'U[]
Given an array and a function that is defined for the indexed elements of the array, returns a new array that consists of the images of the original array under the function.
The type of array
elements.
The result type of the mapper
function.
A function from (Int, 'T)
to 'U
that is used to map elements
and their indices.
An array of elements over 'T
.
An array 'U[]
of elements that are mapped by the mapper
function.
The following two lines are equivalent:
let array = MappedByIndex(f, [x0, x1, x2]);
and
let array = [f(0, x0), f(1, x1), f(2, x2)];