Prefixes 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 all its prefixes.
function Prefixes<'T> (array : 'T[]) : 'T[][]
Description
Returns an array of all prefixes, starting with an array that only has the first element until the complete array.
Input
array : 'T[]
An array of elements.
Output : 'T[][]
Type Parameters
'T
The type of array
elements.
Example
let prefixes = Prefixes([23, 42, 144]);
// prefixes = [[23], [23, 42], [23, 42, 144]]
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for