JuliaCollections / JuliaCollections/DataStructures.jl

`setdiff(::Accumulator, xs)` is incorrect for xs not being an accumulator

Open
#572 1 comment 1 reaction 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

Consider:

julia> x = [1, 2, 2, 3, 3, 3];

# Correct answer:
julia> setdiff(counter(x), counter(unique(x)))
Accumulator{Int64,Int64} with 2 entries:
  2 => 1
  3 => 2

# Incorrect behavour
julia> setdiff(counter(x), unique(x))
3-element Array{Pair{Int64,Int64},1}:
 2 => 2
 3 => 3
 1 => 1

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 reproducing the Julia examples in the issue and then inspect the setdiff methods involving Accumulator, counter, and unique. Done means setdiff(counter(x), unique(x)) returns the expected Accumulator result with the correct counts for 2 and 3.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.