Amend: Difference between revisions

247 bytes added ,  2 years ago
no edit summary
(add amend)
 
No edit summary
Line 1:
{{primitive|@[x;y[;z[];u]]}}
 
'''Amend''' is a special form of the <code>@</code> verb which takes multiple arguments.
Line 6:
* <code>x</code> is an array to amend
* <code>y</code> is the index(or indices) to amend
* <code>z</code>(optional), is the function to be appliedapply to those indices
* <code>u</code> is anthe extrasecond argument ifto <code>z</code> takes two arguments
 
3 argument amend always acts as an element replacement function, since <code>z</code> is [[right|<code>:</code>]] if it is omitted.
 
<code>x</code> can be a value or a symbol. If given a symbol, amend will modify the variable that is indicated by the symbol.
Line 14 ⟶ 16:
v
1 2 3
@[v;1;:;3]
1 3 3
v
1 2 3
@[`v;1;:;3];
v
1 2 3</pre>
 
== ngn/k ==
ngn/k's amend has <code>u</code> as the optional argument, instead of having <code>z</code> as an optional argument.