method batch

Documentation for method batch assembled from the following types:

class Any

From Any

(Any) method batch

Defined as:

multi method batch(Int:D $batch --> Seq)
multi method batch(Int:D :$elems --> Seq)

Coerces the invocant to a list by applying its .list method and uses List.batch on it.

class List

From List

(List) method batch

Defined As:

multi method batch(Int:D $batch --> Seq)
multi method batch(Int:D :$elems --> Seq)

Returns a Seq of the elements in batches of :$elems or $batch, respectively. If the number of elements is not a multiple of $batch, the last batch may have less than $batch elements, similar to .rotor($batch, :partial).

class Supply

From Supply

(Supply) method batch

method batch(Supply:D: :$elems:$seconds --> Supply:D)

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.