3

Say I have a list

b:1 1 2 3 4

and I want to find the location of the element in list b using another list

a:1 2

When I type in b in\ a, I got

11000b
00000b

where it should be

11000b
00100b

What is going on and how to get the desired answer?

Thanks in advance!

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36

2 Answers2

2

You need to use each-right /:

q)b in/:a
11000b
00100b

With b in\a the first output is getting passed back in as b. Effectively:

q)1 1 2 3 4 in 1
11000b
q)11000b in 2
00000b
Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
0

You can also use each-both ':

q)in[b]'[a]
11000b
00100b
Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36