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

Add set operations #6

Open
apasel422 opened this issue Mar 16, 2015 · 6 comments
Open

Add set operations #6

apasel422 opened this issue Mar 16, 2015 · 6 comments

Comments

@apasel422
Copy link
Contributor

The traits can be extended with additional methods that yield the difference and symmetric difference between two ordered iterators. The union is already handled by outer_join, and the intersection is already handled by inner_join.

@apasel422
Copy link
Contributor Author

I think we should rename the join methods to their appropriate set operation name.

@Gankra
Copy link
Contributor

Gankra commented Mar 18, 2015

It's worth noting that these are established terms in relational algebra. I have no strong feelings on the names, otherwise.

@apasel422
Copy link
Contributor Author

Is there a difference other than the names? I've been thinking that it's silly for every (ordered) set implementation to define its own {Difference, Intersection, SymmetricDifference, Union} iterators. It would make sense for this crate to provide a generic implementation as extension methods. The same goes for ordered map iterators.

Note that this is different from optimized set operations that return a new set (e.g. BitSet).

@Gankra
Copy link
Contributor

Gankra commented Mar 18, 2015

That... is an interesting idea. It's not clear to me that the optimal impl is necessarily blanket-able in general, though.

@apasel422
Copy link
Contributor Author

Another reason I favor the generic iterator adaptors here is that it avoids the theoretical combinatoric problem with iteration modes. Right now, the the sets in std and contain-rs only provide by-ref iterators, but there's no reason they couldn't have by-value or by-mut-ref ones, too.

@apasel422
Copy link
Contributor Author

Not to mention the bounded iterators.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants