is-deterministic
ErrorsCollection

is-deterministic

Synthesised documentation from type/Iterator

From type/Iterator

See Original text in context

method is-deterministic(Iterator:D: --> Bool:D)

Should return True for iterators that, given a source, will always produce the values in the same order.

Built-in operations can perform certain optimizations when it is certain that values will always be produced in the same order. Some examples:

say (1..10).iterator.is-deterministic;              # OUTPUT: «True␤» 
say (1..10).roll(5).iterator.is-deterministic;      # OUTPUT: «False␤» 
say %(=> 42=> 137).iterator.is-deterministic# OUTPUT: «False␤»

The Iterator role implements this method returning True, indicating an iterator that will always produce values in the same order.