Using named parameters:
method sorttable(:$column = 0, :$reverse, :&ordering = &infix:<cmp>) { my @result = self»[$column].sort: &ordering; return $reverse ?? @result.reverse !! @result; }
Using optional positional parameters:
method sorttable-pos($column = 0, $reverse?, &ordering = &infix:<cmp>) { my @result = self»[$column].sort: &ordering; return $reverse ?? @result.reverse !! @result; }
Last updated 1 year ago