LookupFunction function
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)
Input
array : 'T[]
The array to be represented as a lookup function.
Output : Int -> 'T
A function f such that f(idx) == f[idx].
Type Parameters
'T
The type of the elements of the array being represented as a lookup function.
Remarks
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.
反馈
提交和查看相关反馈