🔍
Triadic . (dmend)
Applies a monаdic verb to a certain vаlue.
Syntax: .[<x>; <y>; <z>]
whеre z
is a monаdic verb to be applied and x
is a structure to be indexed in depth with a vector index y
.
o)l:(1 2 3;4 5 6); .[l;0 1;{x+1}]
1 3 3
4 5 6
o)d:`a`b`c!(1 2;3 4;5 6);
o).[d;(`a;0);{x+1}]
a| 2 2
b| 3 4
c| 5 6
o)t:flip `a`b!(!3;3+!3)
a b
---
0 3
1 4
2 5
o).[t;(`b;2);{x*3}]
a b
----
0 3
1 4
2 15
o)
For destructive updates use variable symbol in the first argument:
o)a:(1 2 3;4 5 6); .[`a;0 1;{x+1}]
`a
o)a
1 3 3
4 5 6
o)
In triadic dmend the last argument should be monаdic, but some verbs are treated as dyаdic.. Use
:
after the verb to indicate the use of monаdic. o)a: (!5; !4)
0 1 2 3 4
0 1 2 3
o).[a;1 3; -]
** eval error: `amend vec`:
invalid type: [``dyad]
o).[a;1 3; -:]
0 1 2 3 4
0 1 2 -3
o)