Skip to content

Instantly share code, notes, and snippets.

@snarkyboojum
Created June 17, 2010 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snarkyboojum/441829 to your computer and use it in GitHub Desktop.
Save snarkyboojum/441829 to your computer and use it in GitHub Desktop.
diff --git a/src/core/Any-list.pm b/src/core/Any-list.pm
index 2307c03..9890290 100644
--- a/src/core/Any-list.pm
+++ b/src/core/Any-list.pm
@@ -35,6 +35,7 @@ augment class Any {
our multi method sort(&by = &infix:<cmp>) { self.list.sort(&by); }
+ method rotate($n = 1) { self.list.rotate($n); }
multi method first(Mu $test) {
for @.list {
@@ -295,6 +296,7 @@ proto sub kv(@array) { @array.kv; }
proto sub keys(@array) { @array.keys; }
proto sub values(@array) { @array.values; }
proto sub pairs(@array) { @array.pairs; }
+proto sub rotate(@array, $n = 1) { @array.rotate($n); }
multi sub sort(*@values, :&by) {
my &x = &by // (@values[0] ~~ Callable ?? @values.shift !! &infix:<cmp> );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment