* Fixes #346.

* Apply suggestions from code review

Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>

* Apply suggestions from code review

Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>
This commit is contained in:
Mathias Soeken 2021-07-19 18:05:26 +02:00 коммит произвёл GitHub
Родитель 988a9ee37f
Коммит e6807e7427
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -324,13 +324,19 @@ namespace Microsoft.Quantum.Arrays {
/// # Output
/// Multiple arrays where the first array is the first `nElements[0]` of `arr`
/// and the second array are the next `nElements[1]` of `arr` etc. The last array
/// will contain all remaining elements.
/// will contain all remaining elements. If the array is split exactly, the
/// last array will be the empty array, indicating there are no remaining elements.
/// In other words, `Tail(Partitioned(...))` will always return the remaining
/// elements, while `Most(Partitioned(...))` will always return the complete
/// partitions of the array.
///
/// # Remarks
/// ## Example
/// ```qsharp
/// // The following returns [[1, 5], [3], [7]];
/// let split = Partitioned([2,1], [1,5,3,7]);
/// // The following returns [[1, 5], [3, 7], []];
/// let split = Partitioned([2,2], [1,5,3,7]);
/// ```
function Partitioned<'T>(nElements: Int[], arr: 'T[]) : 'T[][] {
mutable output = new 'T[][Length(nElements) + 1];