uid | title | ms.date | ms.topic | qsharp.kind | qsharp.namespace | qsharp.name | qsharp.summary |
---|---|---|---|---|---|---|---|
Microsoft.Quantum.Arrays.Prefixes |
Prefixes function |
7/28/2023 12:00:00 AM |
managed-reference |
function |
Microsoft.Quantum.Arrays |
Prefixes |
Given an array, returns all its prefixes. |
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 all its prefixes.
function Prefixes<'T> (array : 'T[]) : 'T[][]
Returns an array of all prefixes, starting with an array that only has the first element until the complete array.
An array of elements.
The type of array
elements.
let prefixes = Prefixes([23, 42, 144]);
// prefixes = [[23], [23, 42], [23, 42, 144]]