Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit fc459a7

Browse files
authored
Update to new empty array creation syntax (#670)
1 parent 234b856 commit fc459a7

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

BoundedKnapsack/Tasks.qs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace Quantum.Kata.BoundedKnapsack
7171
// Example: For n = 3 and the qubits state |101⟩, return [true, false, true].
7272
operation MeasureCombination01 (selectedItems : Qubit[]) : Bool[] {
7373
// ...
74-
return new Bool[0];
74+
return [];
7575
}
7676

7777

@@ -205,7 +205,7 @@ namespace Quantum.Kata.BoundedKnapsack
205205
// Example: For state selectedItemCounts = [|101⟩, |1110⟩, |0100⟩], return [5, 7, 2].
206206
operation MeasureCombination (selectedItemCounts : Qubit[][]) : Int[] {
207207
// ...
208-
return new Int[0];
208+
return [];
209209
}
210210

211211

GraphColoring/Tasks.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace Quantum.Kata.GraphColoring {
6565
// Example: for N = 2, K = 2 and the qubits in the state |0110⟩ return [2, 1].
6666
operation MeasureColoring (K : Int, register : Qubit[]) : Int[] {
6767
// ...
68-
return new Int[0];
68+
return [];
6969
}
7070

7171

GraphColoring/Tests.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ namespace Quantum.Kata.GraphColoring {
159159
// - regular-ish graph with 5 vertices (3-colorable, as shown at https://en.wikipedia.org/wiki/File:3-coloringEx.svg without one vertex)
160160
// - 6-vertex graph from https://en.wikipedia.org/wiki/File:3-coloringEx.svg
161161
function ExampleGraphs () : (Int, (Int, Int)[])[] {
162-
return [(3, new (Int, Int)[0]),
162+
return [(3, []),
163163
(4, [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]),
164164
(5, [(4, 0), (2, 1), (3, 1), (3, 2)]),
165165
(5, [(0, 1), (1, 2), (1, 3), (3, 2), (4, 2), (3, 4)]),

KeyDistribution_BB84/ReferenceImplementation.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace Quantum.Kata.KeyDistribution {
8181
function GenerateSharedKey_Reference (basesAlice : Bool[], basesBob : Bool[], measurementsBob : Bool[]) : Bool[] {
8282
// If Alice and Bob used the same basis, they will have the same value of the bit.
8383
// The shared key consists of those bits.
84-
mutable key = new Bool[0];
84+
mutable key = [];
8585
for (a, b, bit) in Zipped3(basesAlice, basesBob, measurementsBob) {
8686
if (a == b) {
8787
set key += [bit];

KeyDistribution_BB84/Tasks.qs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace Quantum.Kata.KeyDistribution {
143143
Fact(Length(qs) == Length(bases), "Input arrays should have the same length");
144144

145145
// ...
146-
return new Bool[0];
146+
return [];
147147
}
148148

149149

@@ -170,7 +170,7 @@ namespace Quantum.Kata.KeyDistribution {
170170
Fact(Length(basesAlice) == Length(measurementsBob), "Input arrays should have the same length");
171171

172172
// ...
173-
return new Bool[0];
173+
return [];
174174
}
175175

176176

tutorials/QuantumClassification/Backend.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Microsoft.Quantum.Kata.QuantumClassification {
2424
// The definition of classifier structure for the case when the data is linearly separable and fits into 1 qubit
2525
function ClassifierStructure() : ControlledRotation[] {
2626
return [
27-
ControlledRotation((0, new Int[0]), PauliY, 0)
27+
ControlledRotation((0, []), PauliY, 0)
2828
];
2929
}
3030

tutorials/VisualizationTools/Tests.qs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace Quantum.Kata.VisualizationTools {
8989
// Normalize the amplitudes, to check the answer programmatically.
9090
let amplitudesNorm = PNormalized(2.0, amplitudes);
9191
// Filter out the amplitudes bigger than the threshold.
92-
mutable expected = new Int[0];
92+
mutable expected = [];
9393
for i in IndexRange(amplitudes) {
9494
if amplitudesNorm[i] > 0.01 {
9595
set expected += [i];

0 commit comments

Comments
 (0)