* 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:
Родитель
988a9ee37f
Коммит
e6807e7427
|
@ -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];
|
||||
|
|
Загрузка…
Ссылка в новой задаче