https://learninghub.kx.com/forums/topic/question-in-passing-elements-of-2-same-length-lists-by-each-keyword
Hello all,
Is it possible to pass elements of 2 same-length lists by 'each' keyword in the same time? In my case, list 1 is a nested list of lists, and list 2 contains index of the element on each row in list 1, so I would like to do something like:
{[e1;e2] e1[e2] : new values } [ ; ] each list1,list2
Is there any simple way to do so?
Thanks very mush.
Jacky
' form of each https://code.kx.com/q/ref/maps/#each
q){x[y]:99;x}'[(1 2 3;4 5 6;7 8 9);0 1 2]
99 2 3
4 99 6
7 8 99
Amend at @ version https://code.kx.com/q/ref/apply/#amend-amend-at
q){@[x;y;:;99]}'[(1 2 3;4 5 6;7 8 9);0 1 2]
99 2 3
4 99 6
7 8 99
q)@[;;:;99]'[(1 2 3;4 5 6;7 8 9);0 1 2]
99 2 3
4 99 6
7 8 99