Interleaved 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
Interleaves two arrays of (almost) same size.
function Interleaved<'T> (first : 'T[], second : 'T[]) : 'T[]
Description
This function returns the interleaving of two arrays, starting with the first element from the first array, then the first element from the second array, and so on.
The first array must either be of the same length as the second one, or can have one more element.
Input
first : 'T[]
The first array to be interleaved.
second : 'T[]
The second array to be interleaved.
Output : 'T[]
Interleaved array
Type Parameters
'T
The type of each element of first
and second
.
Example
// same as int1 = [1, -1, 2, -2, 3, -3]
let int1 = Interleaved([1, 2, 3], [-1, -2, -3])
// same as int2 = [false, true, false, true, false]
let int2 = Interleaved(ConstantArray(3, false), ConstantArray(2, true));
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