If the Range is an integer range (as indicated by is-int), then this method returns a list with the first and last value it will iterate over (taking into account excludes-min and excludes-max). If the range is not an integer range, the method will return a two element list containing the start and end point of the range unless either of excludes-min or excludes-max are True in which case a Failure is returned.

If a Callable positional argument is provided, each value is passed into the filter, and its return value is compared instead of the original value. The original values are still used in the returned Range.

In sub form, the invocant is passed as an argument and a comparison Callable can be specified with the named argument :by.

say (1,7,3).minmax(); # OUTPUT:«1..7␤»

say (1,7,3).minmax({-$_}); # OUTPUT:«7..1␤»

sayminmax(1,7,3); # OUTPUT: «1..7␤»

sayminmax(1,7,3,:by( -* )); # OUTPUT: «7..1␤»

This is a work in progress to document Raku (formerly known as Perl 6), and
known to be incomplete.