Splice: Difference between revisions
Content added Content deleted
("Add all appropriate categories to each verb") |
("More lowercasing") |
||
Line 1: | Line 1: | ||
{{primitive|?[x;(s;e);z]|in=K5,K6}} |
{{primitive|?[x;(s;e);z]|in=K5,K6}} |
||
''' |
'''splice''' is a special form of the <code>?</code> verb which takes 3 arguments. |
||
* <code>x</code> is the array to be modified. |
* <code>x</code> is the array to be modified. |
Revision as of 04:43, 9 July 2022
Splice
?[x;(s;e);z]
Supported in | K5,K6 |
splice is a special form of the ?
verb which takes 3 arguments.
x
is the array to be modified.(s;e)
is a two element array indicating start index and end indexz
is the replacement array.
In ngn/k, splice removes the portion of the array x
from s
to e
, exclusive of e
and inserts z
in that place.
?["abcd";3 3;"x"] "abcxd" ?["abcd";3 4;"x"] "abcx"