cancel
Showing results for 
Search instead for 
Did you mean: 

Find (?) Anomalies -- Features or Bugs?

erik_friis
New Contributor III

I read page 406 in the Borror book and it would seem that there is behavior with the find (?) operator that is not addressed there:

 

Notice the different result depending on whether the first item of the left operand is atomic or not:

 

q)(1 2;3;3 4;4)?3 4   / should be 1 3 not 2!

2

 

q)(1;2;3;3 4;4)?3 4

2 4


This expression is documented but I'm not sure I agree with the result, it should be 2 2:


 q)(1 2;3 4)?3 4

1


With the following returning the value 1:


q)(1 2;3 4)?enlist 3 4

,1


There are many more examples that appear to be inconsistent (at least according to Borror's description or simple list vs. general list left operand):


q)(1;2 3;4)?(1 2;(2 3; 4);3 4)

0   3

3 3 2

3   2

 

q)(1;2 3;4)?(1 2;(4;2 3);3 4)

0 3

2 1

3 2


Thanks for any additional insight.




2 REPLIES 2

rahul_asati04
Contributor
It's an strange but expected behavior.

?, bin, except,in and dict look-ups are rank sensitive.

Above discussion discusses the same concept .

Rahul,

Thanks for the reply and link to the other thread.  I don't see rank being referenced in the Borror book "Q For Mortals" other than the built-in rank function.  Do you have a link to a page or document that describes it?