-
-
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
add a function to test sets equality? #25318
Comments
Yes, I've thought the same before. I remember trying to do things like detect whether two |
Why not use We could also find a hashing algorithm which works for |
I think there's more than just an optimization at play here. You might have |
Yes, but that doesn't mean |
I agree we need both. It would not be obvious for me that we want |
That sounds like a good plan to me. In terms of equality of If this weren’t true, it would be hard to create functions that dispatch on |
I think that we probably do want |
Do you mean the (efficient) implementation of the |
I realize also that |
I suggest adding a generic (and ordered independent) |
Fixed by #25368 |
Currently we can do
length(a) == length(b) && issubset(a, b)
(which replicates==(a::Set, b::Set)
), but this is not ideal.Should we add a
issetequal
function? Also, would we want to have sets containing the same elements beisequal
? If so, we could just widen the==
signature forSet
toAbstractSet
, and similarly forhash
(this would be a huge performance regression forhash(::BitSet)
, but this would not be slower than forSet
, and speed is maybe not so important there).And probably similarly for
<
,⊆
etc. Currently, there is some inconsistency: for exampleSet(1) ⊆ BitSet(1)
yieldstrue
, but using⊊
is a method error.Even then, we could still have an
issetequal
function for arrays and iterators.I'm not sure how breaking a change this would be for 1.x. I can volunteer to make a PR in the next few days if needed.
The text was updated successfully, but these errors were encountered: