Documentation for method push-at-least

Documentation for method push-at-least, assembled from the following types:

role Iterator

From Iterator

(Iterator) method push-at-least

Defined as:

method push-at-least(Iterator:D: $targetint $count --> Mu)

Produces at least $count elements, and for each of them, calls $target.push($value).

If fewer than $count elements are available from the iterator, it returns the sentinel value IterationEnd. Otherwise it returns $count.

Iterators with side effects should produce exactly $count elements; iterators without side effects (such as Range iterators) can produce more elements to achieve better performance.

my @array;
say (1 .. Inf).iterator.push-at-least(@array10); # OUTPUT: «10␤» 
say @array# [1 2 3 4 5 6 7 8 9 10]