What is the best way of telling whether an element `x` is present in a 
sorted list `a`?

Using `searchsortedlist`, I also need to check that the element is present 
in the list. This is what I do

function isinsortedlist(a, x)
    n = searchsortedfirst(a, x)
    n <= length(a) && a[n] == x
end

Shouldn't `searchsortedlist` return also a bool to tell whether the element 
is already in the list?

Thank you,
michele

Reply via email to