Zipped 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 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