Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
List.pop
  • Loading branch information
moritz committed Jul 1, 2011
1 parent 437675e commit 70f9c03
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/List.pm
Expand Up @@ -119,6 +119,18 @@ class List does Positional {
!! fail 'Element shifted from empty array';
}

method pop() {
# .elems also reifies
my $e := self.elems;
$e == $Inf
?? fail('Pop from infinite array')
!! (
$e == 0
?? fail('Pop from empty array')
!! nqp::pop($!items)
);
}

multi method perl(List:D \$self:) {
self.gimme(*);
self.Parcel.perl ~ '.list'
Expand Down

0 comments on commit 70f9c03

Please sign in to comment.