Mapped function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Arrays

Package: Microsoft.Quantum.Standard

Given an array and a function that is defined for the elements of the array, returns a new array that consists of the images of the original array under the function.

function Mapped<'T, 'U> (mapper : ('T -> 'U), array : 'T[]) : 'U[]

Input

mapper : 'T -> 'U

A function from 'T to 'U that is used to map elements.

array : 'T[]

An array of elements over 'T.

Output : 'U[]

An array 'U[] of elements that are mapped by the mapper function.

Type Parameters

'T

The type of array elements.

'U

The result type of the mapper function.

Remarks

The function is defined for generic types, i.e., whenever we have an array 'T[] and a function mapper: 'T -> 'U we can map the elements of the array and produce a new array of type 'U[].

See Also