Sorry, the predicate should be
var b T
pred := func(a T) bool { return cmp(a, b) >= 0 }
On Tue, Apr 5, 2022 at 7:27 AM Axel Wagner
wrote:
> Hm I must say, I also don't really understand removing the predicate-based
> one. It is easy, when you have a comparison function, to get to a predicate:
>
Hm I must say, I also don't really understand removing the predicate-based
one. It is easy, when you have a comparison function, to get to a predicate:
pred := func(a, b T) bool { return cmp(a, b) >= 0 }
But not the other way around, so a predicate is more general.
I used the predicate version of
The earlier method signature for slices.BinarySearchFunc was very useful:
It was of the form
```
slices.BinarySearchFunc(array, func(e T) bool)
```
which returned the smallest index at which predicate would return true.
This was incredibly useful to do inequality operation binary searches -
l