-
how to find the first element for each row which satisfy the condition
suppose i have a table
t: ([]isMatched: (1b,1b,0b,0b;1b,1b,0b,0b;0b,0b,1b,1b); index:((0,1,2,3);(0,1,2,3);(0,1,2,3));id: ((`a,`b,`c,`d);(`a,`b,`c,`d);(`a,`b,`c,`d)))
so each row will find use the first element in idx which the corresponding element in isMatched =true. Once the index is find, then that corresponding id is no longer available to pick for rows after. For example, first row idx = 0 is working as first element of isMatched for row 0 is true, Thus id a is no longer available. then for second row it the first element in idx column is 1 as isMatched is ture for 0 and 1 but 0 element of id is selected already. idx is of same length (but might be different order) but id is same for all rows. len of isMatched, idx, id is same too. Is there any better algorithm to solve it in q?
isMatched idx id
————————-
1100b 0 1 2 3 a b c d
1100b 0 1 2 3 a b c d
0011b 0 1 2 3 a b c d
Log in to reply.