Skip to content

Commit

Permalink
Merge remote branch 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
unobe committed Mar 17, 2010
2 parents c52d193 + d0f934f commit d52d50d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/core/Parcel.pm
Expand Up @@ -3,6 +3,8 @@ augment class Parcel {

method list() { self.iterator }

method rotate(Int $n = 1) { self.Seq.rotate($n) }

multi method ACCEPTS($x) {
# smart-matching against Nil
if self.elems == 0 {
Expand Down
5 changes: 5 additions & 0 deletions src/core/Seq.pm
Expand Up @@ -76,6 +76,11 @@ augment class Seq {
)];
}
}

multi method rotate(Int $n = 1) is export {
my Int $k = $n % self.elems;
self[$k .. self.elems-1, 0 .. $k-1];
}
}

# vim: ft=perl6
2 changes: 1 addition & 1 deletion t/spectest.data
Expand Up @@ -437,7 +437,7 @@ S32-array/kv.t
# S32-array/pairs.t
S32-array/pop.t
S32-array/push.t
# S32-array/rotate.t
S32-array/rotate.t
S32-array/shift.t
S32-array/splice.t
S32-array/unshift.t
Expand Down

0 comments on commit d52d50d

Please sign in to comment.