Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[List] pop, push, shift, unshift
  • Loading branch information
moritz committed Jun 10, 2012
1 parent 7578a27 commit 9770e19
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/List.pod
Expand Up @@ -247,4 +247,34 @@ Deletes C<$elems> elements starting from index C<$start> from the list,
returns them and replaces them by C<@replacement>. If C<$elems> is omitted,
all the elements starting from index C<$start> are deleted.
=head3 pop
multi sub pop(List:D )
multi method pop(List:D:)
Removes and returns the last item from the list, fails for an empty list.
=head3 push
multi sub push(List:D, *@values) returns List:D
multi method push(List:D: *@values) returns List:D
Adds the C<@values> to the end of the list, and returns the modified list.
Fails for infinite lists.
=head3 shift
multi sub shift(List:D )
multi method shift(List:D:)
Removes and returns the first item from the list, fails for an empty list.
=head3 unshift
multi sub unshift(List:D, *@values) returns List:D
multi method unshift(List:D: *@values) returns List:D
Adds the C<@values> to the start of the list, and returns the modified list.
Fails if C<@values> is infinite.
=end pod

0 comments on commit 9770e19

Please sign in to comment.