q)(enlist 0;0;1 2 3) bin 0
1
q)(0;enlist 0;1 2 3) bin 0
0
With the find (?) operator the right operand is properly applied at the leading rank of the left operand, whereas the bin operator does not seem to be applied at the correct rank. Am I missing something?
q)(enlist 0;0;1 2 3) ? 0
0
q)(0;enlist 0;1 2 3) ? 0
0
Yes I was missing something that I realized after I posted this: The items in the left operand to the bin operator are not in ascending order. Which brings me to my follow on question – since the operator does not enforce a sorted left operand are the results when it is not undefined?
Wiki says the same thing: http://code.kx.com/wiki/Reference/bin
The items of the left argument should be sorted ascending although bin does not verify that; if the items are not sorted ascending, the result is undefined. The right argument can be either an atom or simple list of the same type as the left argument
Thanks Rahul! The Wiki should be updated as nested lists (to any level of depth and uniformity) can be specified as both the right and left operands as well. The same rules as the find (?) operator apply regarding how the operator is applied to its right operand. The rules are a bit involved in full, but I have documented the complete behavior in my book.