-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Clean up search_sorted* functions #1620
Conversation
This looks good. Any thoughts on how to avoid the @StefanKarpinski did a bunch of work on the comparison functions for sort. |
I'm not clear on that the _gt and _lt versions are for here. |
We don't actually need to expose those functions, and they can also be On Wednesday, November 28, 2012, Stefan Karpinski wrote:
|
Ok, I started thinking that However, I just realized that that statement is not true for I have a slight preference to change the definition of |
I think Also, are you planning on committing timsort into base, or keeping it in a package? |
* Allow to be defined on AbstractVectors * Use 1-based indexing for searching subarrays * Make search_sorted and alias for search_sorted_first * Added documentation
With regard to changing the definition of While it's unlikely, now that we have packages, one other small possibility is that there's a package which uses this function. I could probably install all packages and look, but I need to get some sleep. ;-) Assuming it passes Travis-CI, I think this is mergable for now. For |
Subsumed by #1691. Closing... |
Except I forgot to add the documentation... |
Round out functions with search_sorted_first_gt, search_sorted_last_lt (+ tests)Discussion
Recent commit df7a323 exposed a more general interface to
search_sorted*()
functions, allowing the caller to optionally specify the range to call. This interface was inconsistent betweensearch_sorted()
(1-based) andsearch_sorted_{first,last}()
(0-based, range 0:length(a)+1). The first item above address this issue, using 1-based indexing; internally, 0-based indexing is still used (and this is the 'proper' way to do binary search--see http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary)Some additional deficiencies/idiosyncracies were identified (see df7a323600#commitcomment-2212563) and are addressed by this commit.