How to get positions of element matches in a list in kdb?

1.8k views Asked by At

For instance, if I have a list a:2 5 3 1, I can match another list against it, say b:3 5, which matches the 3 at a[2] and the 5 at a[1]. I am interested in getting my hands on the indices 2 1.

I tried where 3 5 in 2 5 3 1 but didn't work.

1

There are 1 answers

2
WooiKent Lee On BEST ANSWER

I think you should use ? for this:

q)2 5 3 1?3 5
2 1

http://code.kx.com/q/ref/search/#find