uid | title | ms.date | ms.topic | qsharp.kind | qsharp.namespace | qsharp.name | qsharp.summary |
---|---|---|---|---|---|---|---|
Microsoft.Quantum.Arrays.LookupFunction |
LookupFunction function |
7/28/2023 12:00:00 AM |
managed-reference |
function |
Microsoft.Quantum.Arrays |
LookupFunction |
Given an array, returns a function which returns elements of that array. |
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, returns a function which returns elements of that array.
function LookupFunction<'T> (array : 'T[]) : (Int -> 'T)
The array to be represented as a lookup function.
A function f
such that f(idx) == f[idx]
.
The type of the elements of the array being represented as a lookup function.
This function is mainly useful for interoperating with functions and
operations that take Int -> 'T
functions as their arguments. This
is common, for instance, in the generator representation library,
where functions are used to avoid the need to record an entire array
in memory.