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 'IntSet' #4

Closed
4 tasks done
chshersh opened this issue Oct 12, 2017 · 2 comments
Closed
4 tasks done

Add 'IntSet' #4

chshersh opened this issue Oct 12, 2017 · 2 comments

Comments

@chshersh
Copy link
Contributor

chshersh commented Oct 12, 2017

Currently there's only IntMap data structure. But it would be good to have IntSet as well.

This can be implemented easily by creating simple wrapper around IntMap like it's done here for AVL tree:

https://github.com/jfdm/idris-containers/blob/master/Data/AVL/Set.idr

All functions for IntMap should be duplicated:

  • size
  • member
  • insert
  • delete

If some functions from #5 will be implemented earlier than IntSet then those functions should be duplicated as well if possible.

@arbuztw
Copy link
Contributor

arbuztw commented Oct 26, 2017

Hi! I would like to work on this.
However, I am not sure how should I do on Functor and Foldable parts. Also, it seems that values function cannot be implemented directly as a wrapper, since there is no function returning the keys of a map. Does I need to add another function such like keys for IntMap?

@chshersh
Copy link
Contributor Author

Hello, @arbuztw ! Please, take my apologies for not answering fast. I really happy that you're interested in contributing to this project :)

However, I am not sure how should I do on Functor and Foldable parts

Haskell version of IntSet doesn't have Functor and Foldable instances. And you can't implement these instances for IntSet so just don't do it :)

Does I need to add another function such like keys for IntMap?

As you correctly said, there's no keys functions for IntMap because it's not so trivial to implement. Thus you also shouldn't implement this function for IntSet.

arbuztw added a commit to arbuztw/idris-patricia that referenced this issue Oct 27, 2017
@arbuztw arbuztw mentioned this issue Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants