Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:rakudo/rakudo
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Feb 25, 2010
2 parents c9e1981 + 1d4a471 commit a725daa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/core/Array.pm
Expand Up @@ -39,6 +39,27 @@ augment class Array {
$offset, $size);
@ret;
}

# This should probably handle lazy arrays too.
multi method delete(@array is rw: *@indices) {
self!fill;
my @result;
for @indices -> $index {
my $i = $index >= 0
?? $index
!! +@array + $index;
@result.push(@array[$i]);
undefine @array[$i];

# next seems unnecessary but handles an obscure
# edge case
if $i == (@array - 1) {
@array.pop;
}
}
@array.pop while @array.elems && !defined @array[@array.elems - 1];
return @result;
}
}

our proto sub pop(@array) { @array.pop; }
Expand Down
2 changes: 1 addition & 1 deletion src/core/operators.pm
Expand Up @@ -87,7 +87,7 @@ our multi prefix:sym<+^>($x) {
pir::bnot__PP($x)
}

our sub undefine(\$x) {
our sub undefine(Mu \$x) {
my $undefined;
$x = $undefined;
}
Expand Down

0 comments on commit a725daa

Please sign in to comment.