Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Make List.roll(1)/pick(1) match List.roll/pick"
  • Loading branch information
lizmat committed May 9, 2015
1 parent 176f778 commit 835d9b2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/core/List.pm
Expand Up @@ -225,9 +225,7 @@ my class List does Positional { # declared in BOOTSTRAP
## of the list, resulting in an O(n) algorithm.

my Int $elems = self.elems;
unless $elems {
return number == 1 ?? Nil !! ();
}
return () unless $elems;

my int $n = number > $elems ?? $elems !! number.Int;
return nqp::atpos($!items,$elems.rand.floor) if $n == 1;
Expand Down Expand Up @@ -400,9 +398,7 @@ my class List does Positional { # declared in BOOTSTRAP

fail X::Cannot::Infinite.new(:action<.roll from>) if self.infinite;
my $elems = self.elems;
unless $elems {
return number == 1 ?? Nil !! ();
}
return () unless $elems;

my int $n = number.Int;
return nqp::atpos($!items,$elems.rand.floor) if $n == 1;
Expand Down

0 comments on commit 835d9b2

Please sign in to comment.