Re: binary search with reference to append
- Posted by petelomax Jun 15, 2014
- 1731 views
DerekParnell said...
I think that if we were writing this function for inclusion into the library now, we would not have these optional parameters. In hindsight, they are probably a poor design decision. But here we are ... we are stuck with them.
It seems perfectly reasonable to me, if everyone else agrees, to remove them. Of course that would be with a suitable entry in the release notes and both the manual and bsearch.e containing something like
-- Compatibility Note: -- Prior to 4.2 bsearch() allowed the start and end points to be specified. This was agreed to be removed (http://openeuphoria.org/forum/124592.wc), -- if necessary replace eg res = bsearch(needle,haystack,5,10) with res = bsearch(needle,haystack[5..10]), remembering to add 4 to abs(res).
Obviously, that is, if appropriate code changes to manage without them do not adversely affect the performance of next_prime().
Pete