-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
should symdiff care about item multiplicity? #34686
Comments
I feel like this is a correctness issue that should addressed sooner rather than later. I ran into it back in march. At minimum, I think the documentation should address that the results of this function will not be correct if the arguments have duplicates. |
triage agrees that this is a bug. |
This example is just nonsense, for example: julia> symdiff([1, 2, 2], [2, 3, 3, 4])
3-element Vector{Int64}:
1
2
4 |
To expand on that a bit: every other set function that accepts vectors treats them as sets in the sense that an item is in the set if and only if it's in the vector, disregarding multiplicity; why should symdiff be the only one that cares about multiplicity? It's also weird that symdiff as currently implemented doesn't care about which input something is in, only how many times it occurs total in its inputs. |
@StefanKarpinski to clarify, you are saying that the behaviour should be:
right? Not that this is a good implementation, just a correct one. |
Yes that is correct. Might be nice for it to preserve order, but that's more of a detail. |
See #34675. It came up that
symdiff([1, 2, 3, 2]) == [1, 3]
which struck me as... unexpected. I'm opening an issue to discuss whether this is a behavior we actually want.The text was updated successfully, but these errors were encountered: