Resolved: Merge 2 lists according to values in a boolean list 0 By Isaac Tonny on 18/06/2022 Issue Share Facebook Twitter LinkedIn Question: I have a method of achieving this which also explains my question. a:1 2 3 4; b:5 6 7; cond:1101001b; comb:(count cond) # 0N; comb[where cond]:a; comb[where not cond]:b But q has so many utilities for manipulating lists, I am wondering if there is a more direct way of doing this. Answer: rank is what you need. q)comb 1 2 5 3 6 7 4 q)(b,a)rank cond 1 2 5 3 6 7 4 If you have better answer, please add a comment about this, thank you! kdb