Amend: Difference between revisions

334 bytes added ,  1 year ago
"Better category ordering, add redirects to categories, fix pseudo-adverb categories"
(add amend)
 
("Better category ordering, add redirects to categories, fix pseudo-adverb categories")
 
(7 intermediate revisions by 3 users not shown)
Line 1:
{{primitive|@[x;y[;f];z]<br>@[x;uy;f[;z]]}}
 
'''Amendamend''' is a special form of the <code>@</code> verb which takes multiple arguments.
 
Amend takes 3 or 4 arguments, where:
* <code>x</code> is an array to amend
* <code>y</code> is the index(or indices) to amend
* <code>zf</code>(optional), is the function to be appliedapply to those indices
* <code>uz</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 23 3</pre>
 
== ngn/k ==
ngn/k's amend has <code>z</code> as the optional argument, instead of having <code>f</code> as an optional argument.
 
[[Category:Verbs]]
[[Category:Special forms]]
[[Category:Primitives]]
720

edits