Unzipped 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 of 2-tuples, returns a tuple of two arrays, each containing the elements of the tuples of the input array.

function Unzipped<'T, 'U> (arr : ('T, 'U)[]) : ('T[], 'U[])

Input

arr : ('T,'U)[]

An array containing 2-tuples

Output : ('T[],'U[])

Two arrays, the first one containing all first elements of the input tuples, the second one containing all second elements of the input tuples.

Type Parameters

'T

The type of the first element in each tuple

'U

The type of the second element in each tuple

Example

// split is same as ([6, 5, 5, 3, 2, 1], [true, false, false, false, true, false])
let split = Unzipped([(6, true), (5, false), (5, false), (3, false), (2, true), (1, false)]);

See Also