Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Standard/src/Arrays/Arrays.qs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ namespace Microsoft.Quantum.Arrays {
///
/// # Input
/// ## nElements
/// The length of each chunk.
/// The length of each chunk. Must be positive.
/// ## arr
/// The array to be split.
///
Expand All @@ -294,6 +294,7 @@ namespace Microsoft.Quantum.Arrays {
/// Note that the last element of the output may be shorter
/// than `nElements` if `Length(arr)` is not divisible by `nElements`.
function Chunks<'T>(nElements : Int, arr : 'T[]) : 'T[][] {
Fact(nElements > 0, "nElements must be positive");
mutable output = [];
mutable remaining = arr;
while (not IsEmpty(remaining)) {
Expand Down