Skip to content

Commit 7578a27

Browse files
committed
[List] pairs, splice
1 parent 47dbe4a commit 7578a27

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/List.pod

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ Returns
8080
8181
0, 'a', 1, 'b', 2, 'c'
8282
83+
=head3 pairs
84+
85+
multi sub pairs($list) returns List:D
86+
multi method pairs(List:D:) returns List:D
87+
88+
Returns a list of pairs, with the indexes as keys and the list values as
89+
values.
90+
91+
<a b c>.pairs # 0 => 'a', 1 => 'b', 2 => 'c'
8392
8493
=head3 join
8594
@@ -229,5 +238,13 @@ generated that way.
229238
Note that C<reduce> is an implicit loop, and thus responds to C<next>, C<last>
230239
and C<redo> statements.
231240
241+
=head3 splice
242+
243+
multi sub splice(@list, $start, $elems? *@replacement) returns List:D
244+
multi method splice(List:D: $start, $elems? *@replacement) returns List:D
245+
246+
Deletes C<$elems> elements starting from index C<$start> from the list,
247+
returns them and replaces them by C<@replacement>. If C<$elems> is omitted,
248+
all the elements starting from index C<$start> are deleted.
232249
233250
=end pod

0 commit comments

Comments
 (0)