-
-
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
make setdiff not call setdiff!
?
#34675
Conversation
But the call to julia> symdiff([1, 2, 1])
[2] So |
|
Ok, I have no idea what For that matter, i have no idea what |
Chesterton's fence says hello :P |
😂 Though perhaps it is poor form of me to open PRs to get answers |
The docstring of For |
Oh man, that is most definitely not what I would expect symdiff(A, B) == setdiff(A ∪ B, A ∩ B) |
By that same logic, shouldn't |
My impression is that the current choices are made for efficiency. If I'm not mistaken, the general rule for these set operations is that they return a collection without duplicates. To have a second rule "semantically uniquifies all the arguments before processing" (i.e. doesn't consider inputs as "multisets") could make sense; this is what happens currently for For But for I vaguely remember searching for precedent in other languages on this, without success. So I went for the faster implementation, which also has its own logic explained in my previous post, based on the associativity of the operation. This was also what |
Oops, clearly I really messed up this PR. Since I thought I was changing Its been educational but anything coming Friday m it needs to go elsewhere |
Calling
setdiff!
oncopy(x)
seems like its not desirable.