Skip to content

Commit

Permalink
[src/core/Any-list.pm] simplification
Browse files Browse the repository at this point in the history
.signature.params.elems can be written .arity just as well. Did that.
  • Loading branch information
Carl Masak committed Aug 27, 2010
1 parent 2740248 commit a20e62d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/Any-list.pm
Expand Up @@ -77,7 +77,7 @@ augment class Any {
# And use the FIRST: phaser
multi method min($by = { $^a cmp $^b}) {
die "Unable to handle non-closure Ordering yet" unless $by ~~ Code;
my $cmp = $by.signature.params.elems == 2 ?? $by !! { $by($^a) cmp $by($^b) };
my $cmp = $by.arity == 2 ?? $by !! { $by($^a) cmp $by($^b) };

my $min = +Inf;
my $first-time = Bool::True;
Expand All @@ -98,7 +98,7 @@ augment class Any {
# And use the FIRST: phaser
multi method max($by = { $^a cmp $^b}) {
die "Unable to handle non-closure Ordering yet" unless $by ~~ Code;
my $cmp = $by.signature.params.elems == 2 ?? $by !! { $by($^a) cmp $by($^b) };
my $cmp = $by.arity == 2 ?? $by !! { $by($^a) cmp $by($^b) };

my $max = -Inf;
my $first-time = Bool::True;
Expand All @@ -119,7 +119,7 @@ augment class Any {
# And use the FIRST: phaser
multi method minmax($by = { $^a cmp $^b}) {
die "Unable to handle non-closure Ordering yet" unless $by ~~ Code;
my $cmp = $by.signature.params.elems == 2 ?? $by !! { $by($^a) cmp $by($^b) };
my $cmp = $by.arity == 2 ?? $by !! { $by($^a) cmp $by($^b) };

my $min = +Inf;
my $max = -Inf;
Expand Down

0 comments on commit a20e62d

Please sign in to comment.