Cut: Difference between revisions

From The K Language Wiki
Content added Content deleted
No edit summary
(add repinds)
Line 7: Line 7:
Indices must be given in ascending order.
Indices must be given in ascending order.


<pre>
<pre> 0 4_"feedface"
0 4_"feedface"
("feed";"face")
("feed";"face")


3 5_"adfdsfsdfa"
3 5_"adfdsfsdfa"
("ds"
("ds"
"fsdfa")
"fsdfa")</pre>

</pre>
Repeating indices add empty cuts in that location:
<pre> 0 2 4 4 4_"abcde"
("ab"
"cd"
""
""
,"e")</pre>

Revision as of 04:55, 9 January 2022

Cut
x_y
Supported in K9

The cut primitive partitions the array y before the indices given in array x.

The portion of the array before the first index is ignored.

Indices must be given in ascending order.

 0 4_"feedface"
("feed";"face")

 3 5_"adfdsfsdfa"
("ds"
 "fsdfa")

Repeating indices add empty cuts in that location:

 0 2 4 4 4_"abcde"
("ab"
 "cd"
 ""
 ""
 ,"e")