Revision 27062

Date:
2009/06/12 16:33:26
Author:
lwall
Revision Log:
[Containers] add @array.rotate, define push and unshift to return array
Files:

Legend:

 
Added
 
Removed
 
Modified
  • docs/Perl6/Spec/S32-setting-library/Containers.pod

     
    15 15 Moritz Lenz <moritz@faui2k3.org>
    16 16 Tim Nelson <wayland@wayland.id.au>
    17 17 Date: 19 Feb 2009 extracted from S29-functions.pod
    18 Last Modified: 5 May 2009
    19 Version: 7
    18 Last Modified: 12 May 2009
    19 Version: 8
    20 20
    21 21 The document is a draft.
    22 22
     
    475 475
    476 476 =item push
    477 477
    478 our Int multi method push ( @array: *@values ) is export
    478 our Array multi method push ( @array: *@values ) is export
    479 479
    480 Add to the end of C<@array>, all of the subsequent arguments.
    480 Add to the end of C<@array>, all of the subsequent arguments and
    481 returns the array.
    481 482
    483 =item rotate
    484
    485 our Array multi method rotate ( @array: Int $n ) is export
    486
    487 Rotates the array and returns it. A positive rotation of 1
    488 is defined as:
    489
    490 @array.push(@array.shift);
    491
    492 A negative shift of 1 is defined as:
    493
    494 @array.unshift(@array.pop);
    495
    482 496 =item shift
    483 497
    484 498 our Scalar multi method shift ( @array: ) is export
     
    522 536
    523 537 =item unshift
    524 538
    525 our Int multi method unshift ( @array: *@values ) is export
    539 our Array multi method unshift ( @array: *@values ) is export
    526 540
    527 C<unshift> adds the values onto the start of the C<@array>.
    541 C<unshift> adds the values onto the start of the C<@array> and
    542 returns the array.
    528 543
    529 544 =item keys
    530 545