JuliaCollections / JuliaCollections/DataStructures.jl

RFC: patched searchsortedfirst, searchsortedlast, searchsorted, and insorted available in DataStructures.jl?

Open
#782 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
745
Forks
261
PR merge metrics
No merged PRs in 30d

Description

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 https://github.com/JuliaLang/julia/pull/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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing DataStructures.jl's existing overloads for Base.searchsortedfirst, searchsortedlast, searchsorted, and insorted. Then read the linked Discourse discussion and rejected Julia PR #35418 to understand the proposed behavior. Done means reaching a maintainer decision on whether patched versions belong in DataStructures and defining their intended scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.