How can i determine the index of first and last occurence of an element in a list in kdb. The list obviously has repeat values and is not sorted. The list contains only floats (prices) if that matters. I tried using bin and binr but its not giving the desired results.
May I suggest an alternative (simpler? easier to read? more general?) solution:
q)list:1 2 3 2 4 2 5f
q)list=2.0
0101010b
q)where list=2.0
1 3 5
q)first where list=2.0
1
q)last where list=2.0
5