Skip to content

add a function to test sets equality? #25318

@rfourquet

Description

@rfourquet

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 be isequal ? If so, we could just widen the == signature for Set to AbstractSet, and similarly for hash (this would be a huge performance regression for hash(::BitSet), but this would not be slower than for Set, and speed is maybe not so important there).

And probably similarly for <, etc. Currently, there is some inconsistency: for example Set(1) ⊆ BitSet(1) yields true, 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    collectionsData structures holding multiple items, e.g. sets

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions