I have table which has say 4 column as shown below. I want to pass three of these (price,size and det ) into a function to perform some operation for each row.
a price size det
---------------------
sym1 10 20 `a
sym2 15 10 `b
sym3 18 30 `c
I have a function getDet which is defined as below and calls this function on a handle with these three column as parameter from each row, how can i do it ?
getDet:{[x;y;z} Does something inside here using x,y,z }
h(getDet;x;y;z)
call 1 : h(getDet;10;20;`a)
call 2 : h(getDet;15;10;`b)
call 3 : h(getDet;18;30;`c)
What is the best way to do it ? I was wondering how can i select any 3 columns from a table and pass these as 3 separate parameter x,y,z in a function ?
Here I've defined my own version of getDet
which takes 3 arguments and used handle 0 to execute on the main thread:
q)t:([]a:`sym1`sym2`sym3;price:10 15 18;size: 20 10 30;det:`a`b`c)
q)getDet:{z;x+y}
q){0(getDet;x`price;x`size;x`det)}each t
30 25 48