Iterate a unary
v1 each x each[v1;x] v1 peach x peach[v1;x] (vv)each x each[vv;x] (vv)peach x peach[vv;x]
vv as a unary to each item of
x and returns a result of the same length.
That is, the projections
peach[vv;] are uniform functions.
q)count each ("the";"quick";" brown";"fox") 3 5 5 3 q)(+\)peach(2 3 4;(5 6;7 8);9 10 11 12) 2 5 9 (5 6;12 14) 9 19 30 42
peach perform the same computation and return the same result.
peach will divide the work between available secondary tasks.
each is redundant with atomic functions. (Common qbie mistake.)
peach applies only unary values.
For a values of rank ≥2, use Apply to project
v as a unary value.
For example, suppose
m is a 4-column matrix and each row has values for the arguments of
.[v4;]peach m will apply
v4 to each list of arguments.
t is a table in which columns
a are arguments of
.[v3;]peach flip t `b`c`a will apply
v3 to the arguments in each row of
hopen socket websocket open socket broadcast (25!x) amending global variables load master decryption key (-36!)
And any system command which might cause a change of global state.
Generally, do not use a socket within
peach, unless it is encapsulated via one-shot or HTTP client request.
If you are careful to manage your file handles/file access so that there is no parallel use of the same handle (or file) across threads, then you can open and close files within
Streaming execute (
-11!) should also be fine. However updates to global variables are not possible, so use cases might be quite restricted within