Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 1.46 KB

microsoft.quantum.arrays.lookupfunction.md

File metadata and controls

59 lines (39 loc) · 1.46 KB
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.

LookupFunction 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, 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.