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 = -42;max= 0 # read as: $foo increases to 0
class Range
From Range
(Range) method max
method max(Range:)
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: = :<cmp> --> Supply)
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.
class Any
From Any
(Any) method max
Defined as:
multi method max()multi method max()multi sub max(+args, :!)multi sub max(+args)
Coerces the invocant to Iterable and returns the numerically largest element; in the case of Hash
es, the Pair
with the highest value.
If a Callable positional argument is provided, each value is passed into the filter, and the return value is compared instead of the original value. The original value is still the one returned from max
.
say (1,7,3).max(); # OUTPUT:«7»say (1,7,3).max(); # OUTPUT:«1»say max(1,7,3,:by( )); # OUTPUT: «1»say max(1,7,3); # OUTPUT: «7»max( %(a => 'B', b=> 'C' ) ).say; # OUTPUT: «b => C»