Skip to content
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

Set function to check for intersection? #13189

Closed
eschnett opened this issue Sep 17, 2015 · 4 comments
Closed

Set function to check for intersection? #13189

eschnett opened this issue Sep 17, 2015 · 4 comments
Labels
collections Data structures holding multiple items, e.g. sets

Comments

@eschnett
Copy link
Contributor

When dealing with sets, one often needs to check whether two sets have a non-empty intersection, but the intersection itself is not interesting. This can currently be written as isempty(a ∩ b), but this is likely much less efficient. There should be a function that checks for intersection, returning Bool.

What would be a good name for this? Python uses isdisjoint.

@JeffBezanson
Copy link
Member

Seems like a good idea, and a decent name. This seems to be one of those weird cases where the only word for something is negative; you can be "disjoint" or even "nondisjoint" but not "joint".

@eschnett
Copy link
Contributor Author

You can be "intersecting", so isintersecting would also work.

However, if you allow three sets as arguments, the meanings differ -- isdisjoint implies they are all disjoint, whereas isintersecting implies they are all intersecting, thus they are not opposites. (This is relevant since Base has multi-argument methods for intersect and union.)

@StefanKarpinski
Copy link
Member

It depends on if you mean pairwise disjointness and pairwise intersection or not.

@kshyatt kshyatt added the collections Data structures holding multiple items, e.g. sets label Jan 25, 2017
@rfourquet
Copy link
Member

Fixed in #34427.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collections Data structures holding multiple items, e.g. sets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants