-
-
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: searchsorted new keyword argument arrayby
#35418
Conversation
arrayby
arrayby
bump |
I just wanted to post here that I'm paying attention to this and have discussed it with people on the Slack #triage channel and last week's triage call. The general feeling was that adding this new keyword argument here feels unfortunate and a bit ad hoc. It would be better to accomplish this by |
Yeah, my thoughts are that this is a real pain-point and a great pull request but the solution is unsatisfactory to me — largely due to the It's worth noting the prior art here: @haampie did some experiments here in SortingSortingOut.jl, but that too seems fiddly. I favor composition of separate functions over embedded complexity, so @tkf's vision is more in-line with where I'd like to see this go. It can be reality today with MappedArrays and the like. So is there space for a stopgap keyword argument like this? Maybe, I suppose, but I am having a really hard time coming up with a name that feels right. My first thought on |
Before I close this request, I want to explain my concerns. I am in no way in favour of any new keyword argument; I am not the first one, who complains a missing feature. So the natural way of fixing that would be to give Unfortunately
I appreciate @mbauman 's thougths. Actually after I detected that |
Truth is that the sorting and ordering API has not changed much since 2013. An adequate API for Julia 2.0 is very much possible (I would think...) |
Fixes #9429 and fixes #35381
The new keyword argument
arrayby=identity
is added to methods ofsearchsorted
,searchsortedfirst
, andsearchsortedlast
as a complement toby
. Only one of the twotransformations must be specified (different from
identity
).In contrast to
by
the values ofarrayby
is only applied to the elements of vectora
, not to the comparison value, which is searched for.It is assumed, that
arrayby.(a)
is sorted according to the order defined by other arguments.