JuliaCollections / JuliaCollections/DataStructures.jl
Support `pushfirst!` and `popfirst!` for ordered collections
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 745
- Forks
- 261
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice to have these for OrderedDict and OrderedSet. At the moment in Julia 0.7:
julia> using DataStructures
julia> o = OrderedSet([1,2,3])
OrderedSet{Int64}([1, 2, 3])
julia> push!(o, 4)
OrderedSet{Int64}([1, 2, 3, 4])
julia> pop!(o, 4)
4
julia> pushfirst!(o, 0)
ERROR: MethodError: no method matching pushfirst!(::OrderedSet{Int64}, ::Int64)
Closest candidates are:
pushfirst!(::Any, ::Any, ::Any) at abstractarray.jl:2040
pushfirst!(::Any, ::Any, ::Any, ::Any...) at abstractarray.jl:2041
pushfirst!(::Array{T,1}, ::Any) where T at array.jl:1063
...
Stacktrace:
[1] top-level scope at none:0
julia> popfirst!(o)
ERROR: MethodError: no method matching popfirst!(::OrderedSet{Int64})
Closest candidates are:
popfirst!(::DataStructures.IntSet) at /Users/omus/.julia/packages/DataStructures/eUHI/src/int_set.jl:90
popfirst!(::BitSet) at bitset.jl:255
popfirst!(::BitArray{1}) at bitarray.jl:817
...
Stacktrace:
[1] top-level scope at none:0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the OrderedDict and OrderedSet implementations and reviewing their existing push! and pop! methods. Check Julia's pushfirst! and popfirst! behavior for ordered collections, then verify that both types support the requested operations with the ordering shown in the issue examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100