Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle 0-arg [min] and [max], fixes #71
  • Loading branch information
sorear committed Jun 25, 2012
1 parent 95a1946 commit 07900b5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/CORE.setting
Expand Up @@ -1684,7 +1684,7 @@ my class List is Cool does Positional {
if $cmp_.count == 1 {
$cmp = sub (\x, \y) { $cmp_(x) cmp $cmp_(y) }
}
my $min = self[0];
my $min = self[0] // return Inf;
for @(self) {
$min = $_ if $cmp($_, $min) < 0;
}
Expand All @@ -1696,7 +1696,7 @@ my class List is Cool does Positional {
if $cmp_.count == 1 {
$cmp = sub (\x, \y) { $cmp_(x) cmp $cmp_(y) }
}
my $max = self[0];
my $max = self[0] // return -Inf;
for @(self) {
$max = $_ if $cmp($_, $max) > 0;
}
Expand All @@ -1708,7 +1708,7 @@ my class List is Cool does Positional {
if $cmp_.count == 1 {
$cmp = sub (\x, \y) { $cmp_(x) cmp $cmp_(y) }
}
my $min = self[0];
my $min = self[0] // return Inf .. -Inf;
my $max = self[0];
for @(self) {
$min = $_ if $cmp($_, $min) < 0;
Expand Down

0 comments on commit 07900b5

Please sign in to comment.