File tree Expand file tree Collapse file tree 2 files changed +22
-22
lines changed Expand file tree Collapse file tree 2 files changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -164,4 +164,26 @@ Usage:
164
164
Adds the elements from C < LIST > to the front of the array, modifying it
165
165
in-place.
166
166
167
+ = head2 routine splice
168
+
169
+ Defined as:
170
+
171
+ multi sub splice(@list, $start, $elems?, *@replacement) returns Array
172
+ multi method splice(Array:D $start, $elems?, *@replacement) returns Array
173
+
174
+ Usage:
175
+
176
+ splice(ARRAY, START, ELEMS?, REPLACEMENT?)
177
+ ARRAY.splice(START, ELEMS?, REPLACEMENT?)
178
+
179
+ Deletes C < $elems > elements starting from index C < $start > from the C < Array > ,
180
+ returns them and replaces them by C < @replacement > . If C < $elems > is omitted,
181
+ all the elements starting from index C < $start > are deleted.
182
+
183
+ Example:
184
+
185
+ my @foo = <a b c d e f g>;
186
+ say @foo.splice(2, 3, <M N O P>); # c d e
187
+ say @foo; # a b M N O P f g
188
+
167
189
= end pod
Original file line number Diff line number Diff line change @@ -754,28 +754,6 @@ I<Note:> In the functional programming world, this operation is generally
754
754
called a L < left fold|
755
755
https://en.wikipedia.org/wiki/Fold_%28higher-order_function%29#Folds_on_lists > .
756
756
757
- = head2 routine splice
758
-
759
- Defined as:
760
-
761
- multi sub splice(@list, $start, $elems?, *@replacement) returns List:D
762
- multi method splice(List:D: $start, $elems?, *@replacement) returns List:D
763
-
764
- Usage:
765
-
766
- splice(LIST, START, ELEMS?, REPLACEMENT?)
767
- LIST.splice(START, ELEMS?, REPLACEMENT?)
768
-
769
- Deletes C < $elems > elements starting from index C < $start > from the list,
770
- returns them and replaces them by C < @replacement > . If C < $elems > is omitted,
771
- all the elements starting from index C < $start > are deleted.
772
-
773
- Example:
774
-
775
- my @foo = <a b c d e f g>;
776
- say @foo.splice(2, 3, <M N O P>); # c d e
777
- say @foo; # a b M N O P f g
778
-
779
757
= head2 routine combinations
780
758
781
759
Defined as:
You can’t perform that action at this time.
0 commit comments