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

Standard library should have a set module #2640

Closed
catamorphism opened this issue Jun 18, 2012 · 4 comments
Closed

Standard library should have a set module #2640

catamorphism opened this issue Jun 18, 2012 · 4 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@catamorphism
Copy link
Contributor

There's code in rustc that represents sets as hash maps with value type (), and that's a little hokey. Sets should be in the standard library.

@Dretch
Copy link
Contributor

Dretch commented Jun 20, 2012

It would also be nice to be able to pass in the hash/eq fns using ifaces, like:

// somewhere in core
iface eq { fn eq (a: self) -> bool; }
iface hash { fn hash () -> uint; }

// a set module constructor
fn mk_set <V:eq hash copy> () -> set<V> { ... }

// to construct a set of some type with eq and hash in scope:
let s = set::mk_set();
s.insert(...);

Actually the same thing would be nice for maps, too.

@catamorphism
Copy link
Contributor Author

@Dretch That would be good, yes.

@catamorphism
Copy link
Contributor Author

b86c90b is a start towards this, but the usual set operations still need to be added.

@catamorphism
Copy link
Contributor Author

b927e48 closes this. Thanks, @thestinger !

RalfJung pushed a commit to RalfJung/rust that referenced this issue Nov 6, 2022
Aaron1011 pushed a commit to Aaron1011/rust that referenced this issue Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

2 participants