Question: Problem with BinarySearch sintax



Could you please help me with the following problem? 

I have a list, say, L:= [2,3,4,5]; 

and I need to find the position of several of its elements. However, when a apply the BinarySearch command I get a wrong return. For example, element >= 5:  BinarySearch(L, 5, `>=`);  

Maple returns 0

Element = 4: BinarySearch(L, 4, `=`); 

Maple returns 0

Element < 3: BinarySearch(L, 3, `<`); 

Maple returns 2. 

Obviusly, I'm doing something wrong. Could you please tell me what it is?

Many thanks for your help.


Please Wait...