You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A number of Julia users including me have been stung by unexpected behavior in the searchsorted suite of functions in Base, namely, that the by transformation is applied also to the key. There is a recent discussion (https://discourse.julialang.org/t/problem-with-searchsortedfirst/73332/31) of this on discourse, but it has come up before. This makes the suite awkward to use when the by function is something like first that extracts part of a larger object. A PR JuliaLang/julia#35418 to fix this problem was rejected by the core team. I am wondering: Would it make sense to offer patched versions of these Base function in the DataStructures package? Note DataStructures already overloads Base.searchsortedfirst, etc., specifically for sorted containers, so it would not be totally random.
The text was updated successfully, but these errors were encountered:
I was thinking of a new type, say SortedVector, that would patch this issue. So the user would say: searchsorted(SortedVector(my_vector, extract_key_from_record=(x->x.first)), key, by=func). Then the docstring for Base.searchsorted could briefly mention the awkwardness of applying by to the key and the existence of this alternative.
ah, in that case i think it is less evil, but better to put in a new package in JuliaCollections or elsewhere.
I think you should have the rights sufficient to create such a new package
A number of Julia users including me have been stung by unexpected behavior in the
searchsorted
suite of functions in Base, namely, that theby
transformation is applied also to the key. There is a recent discussion (https://discourse.julialang.org/t/problem-with-searchsortedfirst/73332/31) of this on discourse, but it has come up before. This makes the suite awkward to use when theby
function is something likefirst
that extracts part of a larger object. A PR JuliaLang/julia#35418 to fix this problem was rejected by the core team. I am wondering: Would it make sense to offer patched versions of these Base function in the DataStructures package? Note DataStructures already overloads Base.searchsortedfirst, etc., specifically for sorted containers, so it would not be totally random.The text was updated successfully, but these errors were encountered: