Skip to content

Commit

Permalink
Restore List.rotate method.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Jun 17, 2010
1 parent 5832221 commit e3eb608
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/List.pm
Expand Up @@ -35,6 +35,11 @@ augment class List does Positional {
'(' ~ self.map({ $^a.perl }).join(', ') ~ ')';
}
method rotate($n = 1) is export {
my $k = $n % self.elems;
self[$k .. self.elems-1, 0 .. $k-1];
}
multi method sort(&by = &infix:<cmp>) {
# Parrot already provides a sort method that works on
# ResizablePMCArray, so we aim to make use of that here.
Expand Down

0 comments on commit e3eb608

Please sign in to comment.