Zipped function
Namespace: Microsoft.Quantum.Arrays
Package: Microsoft.Quantum.Standard
Given two arrays, returns a new array of pairs such that each pair contains an element from each original array.
function Zipped<'T, 'U> (left : 'T[], right : 'U[]) : ('T, 'U)[]
Input
left : 'T[]
An array containing values for the first element of each tuple.
right : 'U[]
An array containing values for the second element of each tuple.
Output : ('T,'U)[]
An array containing pairs of the form (left[idx], right[idx]) for
each idx. If the two arrays are not of equal length, the output will
be as long as the shorter of the inputs.
Type Parameters
'T
The type of the left array elements.
'U
The type of the right array elements.
Example
let left = [1, 3, 71];
let right = [false, true];
let pairs = Zipped(left, right); // [(1, false), (3, true)]
See Also
反馈
提交和查看相关反馈