method batch
1 | class List |
1.1 | (List) method batch |
2 | class Supply |
2.1 | (Supply) method batch |
3 | class Any |
3.1 | (Any) method batch |
Documentation for method batch
assembled from the following types:
class List
From List
(List) method batch
Defined As:
multi method batch(Int --> Seq)multi method batch(Int : --> Seq)
Returns a sequence of lists, wherein each list with the exception of the last one is guaranteed to comprise a number of elements equal to the batch size specified by $batch
or $elems
, respectively. If the invocant has a number of elements that is not an integer multiple of the batch size, the last list in the returned sequence will contain any remaining elements and thus have less than $batch
or $elems
elements. Accordingly, .batch($batch)
is shorthand for .rotor($batch, :partial)
.
class Supply
From Supply
(Supply) method batch
method batch(Supply: :, : --> Supply)
Creates a new supply that batches the values of the given supply by either the number of elements in the batch (using :elems
) or the maximum number of seconds (using the :seconds
) or both. Any remaining values are emitted in a final batch when the supply is done.
class Any
From Any
(Any) method batch
Defined as:
multi method batch(Int )multi method batch(Int :!)
Coerces the invocant to a list
by applying its .list
method and uses List.batch
on it.