I’m having some trouble translating an upset into functional form:
q)ticks:([sym:()] price:(); size:(); ae:())
q)parse “ticks upsert (
AAPL;100.0;10;1b)”
.[;();,;]
,`ticks
(enlist;,`AAPL;100f;10;1b)
understand line #2 and #3 are first and second argument, respectively. How would these arguments be applied to the dot (amend)? Guess I don’t understand the amend function correctly.
Thanks.
Here you go:
q).[ticks;();,;(`AAPL;100f;10;1b)]
sym price size ae
AAPL 100 10 1
Thank you Himanshu.
Guess I was confused over the 3rd argument (,) - is it interpreted as join? I was replacing it with enlist.
You’re welcome!
@ and . and not like functional forms of select/update (? and !) where the parameters are t,c,b,a.
@ and . have different parameters.
You can read about them here:
http://code.kx.com/wiki/JB:QforMortals2/functions#Functional\_Forms\_of\_Amend
Basically,
first parameter (`ticks) is the table/list/dictionary,
second parameter () is a subset of that data set that you want to modify,
third parameter (,) is the function/operation you want to apply to that subset and
fourth parameter (`AAPL;100f;10;1b) is any argument for the function/operation passed as the third argument.