>From execution control chapter, how does this work ? zs:{d
PL
G`D!(system"d"),v[1 2 3],enlist last v:value x}
/Define a function to investigate
q)f:{x+y+z}
/call the ‘zs’ function and use our function as the param
q)zs f
d| `.
P| x
y`z
L| `symbol$()
G| ,`
D| “{x+y+z}”
/When the zs function is called, the result of ‘value x’ (where x is our param i.e. the global function ‘f’) is assigned to the local variable ‘v’. e.g.
q)show v:value f
0x7a794178410003
x
y`z
`symbol$()
,`
“{x+y+z}”
/The above is the bulk of the output. Now we create a list composed of ‘system"d"’ (current context), v[1 2 3] (values at index 1 2 3 of the local variable v) and lastly, ‘enlist last v’. The output is as follows;
q)f
{x+y+z}
q)
q)value f
0x7a794178410003
x
y`z
`symbol$()
,`
“{x+y+z}”
q)
q)system[“d”],v[1 2 3],enlist last v:value f
`.
x
y`z
`symbol$()
,`
“{x+y+z}”
/Finally a dictionary is created with the above list as the values
q)d
PL
G`D!system[“d”],v[1 2 3],enlist last v:value f
d| `.
P| x
y`z
L| `symbol$()
G| ,`
D| “{x+y+z}”
Does this answer your question?
Cheers,
Michael