Exclude 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

Returns an array containing the elements of another array, excluding elements at a given list of indices.

function Exclude<'T> (remove : Int[], array : 'T[]) : 'T[]

Input

remove : Int[]

An array of indices denoting which elements should be excluded from the output.

array : 'T[]

Array of which the values in the output array are taken.

Output : 'T[]

An array output such that output[0] is the first element of array whose index does not appear in remove, such that output[1] is the second such element, and so forth.

Type Parameters

'T

The type of the array elements.

Example

let array = [10, 11, 12, 13, 14, 15];
// The following line returns [10, 12, 15].
let subarray = Exclude([1, 3, 4], array);