method push-exactly

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

role Iterator

From Iterator

(Iterator) method push-exactly

Defined as:

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

Should produce $count elements, and for each of them, call $target.push($value).

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

my @array;
say (1 .. Inf).iterator.push-exactly(@array3); # OUTPUT: «3␤» 
say @array# OUTPUT: «[1 2 3]␤» 

The Iterator role implements this method in terms of pull-one.