@@ -205,12 +205,14 @@ Example:
205
205
206
206
Defined as:
207
207
208
- multi sub splice(@list, $start, $elems?, *@replacement --> Array)
209
- multi method splice(Array:D $start, $elems?, *@replacement --> Array)
208
+ multi sub splice(@list, $start = 0 , $elems?, *@replacement --> Array)
209
+ multi method splice(Array:D $start = 0 , $elems?, *@replacement --> Array)
210
210
211
211
Deletes C < $elems > elements starting from index C < $start > from the C < Array > ,
212
212
returns them and replaces them by C < @replacement > . If C < $elems > is omitted,
213
- all the elements starting from index C < $start > are deleted.
213
+ all the elements starting from index C < $start > are deleted. If both C < $start >
214
+ and C < $elems > are omitted, all elements are deleted from the C < Array > and
215
+ returned.
214
216
215
217
Each of C < $start > and C < $elems > can be specified as a
216
218
L < Whatever|/type/Whatever > or as a L < Callable|/type/Callable > that returns an
@@ -222,7 +224,7 @@ argument—the number of elements in C<@list>—and its return value is used
222
224
as C < $start > .
223
225
224
226
A C < Whatever > C < $elems > deletes from C < $start > to end of
225
- C < @list > (same as no C < $elems > ). A C < Callable > C < $elements > is called with
227
+ C < @list > (same as no C < $elems > ). A C < Callable > C < $elems > is called with
226
228
just one argument—the number of elements in C < @list > minus the value of
227
229
C < $start > —and its return value is used the value of C < $elems > .
228
230
0 commit comments