Author: lwall
Date: 2009-06-12 18:33:26 +0200 (Fri, 12 Jun 2009)
New Revision: 27062
Modified:
docs/Perl6/Spec/S32-setting-library/Containers.pod
Log:
[Containers] add @array.rotate, define push and unshift to return array
Modified: docs/Perl6/Spec/S32-setting-library/Containers.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-06-12 16:30:25 UTC
(rev 27061)
+++ docs/Perl6/Spec/S32-setting-library/Containers.pod 2009-06-12 16:33:26 UTC
(rev 27062)
@@ -15,8 +15,8 @@
Moritz Lenz <[email protected]>
Tim Nelson <[email protected]>
Date: 19 Feb 2009 extracted from S29-functions.pod
- Last Modified: 5 May 2009
- Version: 7
+ Last Modified: 12 May 2009
+ Version: 8
The document is a draft.
@@ -475,10 +475,24 @@
=item push
- our Int multi method push ( @array: *...@values ) is export
+ our Array multi method push ( @array: *...@values ) is export
-Add to the end of C<@array>, all of the subsequent arguments.
+Add to the end of C<@array>, all of the subsequent arguments and
+returns the array.
+=item rotate
+
+ our Array multi method rotate ( @array: Int $n ) is export
+
+Rotates the array and returns it. A positive rotation of 1
+is defined as:
+
+ @array.push(@array.shift);
+
+A negative shift of 1 is defined as:
+
+ @array.unshift(@array.pop);
+
=item shift
our Scalar multi method shift ( @array: ) is export
@@ -522,9 +536,10 @@
=item unshift
- our Int multi method unshift ( @array: *...@values ) is export
+ our Array multi method unshift ( @array: *...@values ) is export
-C<unshift> adds the values onto the start of the C<@array>.
+C<unshift> adds the values onto the start of the C<@array> and
+returns the array.
=item keys