JuliaCollections / JuliaCollections/DataStructures.jl
define emptymutable for all sets so that map, filter etc return right type
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Julia
- Stars
- 745
- Forks
- 261
- PR merge metrics
- No merged PRs in 30d
Description
We should define Base.emptymutable for all out mutable AbstractSet subtypes.
Consider SortedSet
julia> filter(isodd, SortedSet((1,2,3,4)))
Set{Int64} with 2 elements:
3
1
But if we define:
Base.emptymutable(s::SortedSet{T}, ::Type{U}=T) where {T,U} = SortedSet{U}()
then we get
julia> filter(isodd, SortedSet((1,2,3,4)))
SortedSet{Int64,Base.Order.ForwardOrdering} with 2 elements:
1
3
see also
https://github.com/JuliaLang/julia/issues/34677#issuecomment-594125450
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 mutable AbstractSet subtypes and their Base.emptymutable entry points, using SortedSet and the filter example in this issue as the initial case. Verify the collection operations shown return the appropriate set type for every applicable subtype and element type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100