Documentation for routine max

Documentation for routine max, assembled from the following types:

language documentation Operators

From Operators

(Operators) infix max

Returns the largest of the arguments, as determined by cmp semantics.

my $foo = -42;
$foo max= 0   # read as: $foo increases to 0 

class Any

From Any

(Any) method max

Defined As:

multi method max(--> Any:D)
multi method max(&custom-routine-to-use --> Any:D)

Coerces to Iterable and returns the numerically biggest element. If a Callable positional argument is provided it is called with each element and its biggest return values is returned.

class Range

From Range

(Range) method max

method max(Range:D:)

Returns the end point of the range.

say (1..5).max;                                   # OUTPUT: «5␤» 
say (1^..^5).max;                                 # OUTPUT: «5␤» 

class Supply

From Supply

(Supply) method max

method max(Supply:D: &custom-routine-to-use = &infix:<cmp> --> Supply:D)

Creates a supply that only emits values from the given supply if they are larger than any value seen before. In other words, from a continuously ascending supply it will emit all the values. From a continuously descending supply it will only emit the first value. The optional parameter specifies the comparator, just as with Any.max.