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

Missing functions #78

Closed
copy opened this issue Sep 25, 2016 · 2 comments
Closed

Missing functions #78

copy opened this issue Sep 25, 2016 · 2 comments

Comments

@copy
Copy link
Contributor

copy commented Sep 25, 2016

I've developed a small application using containers, and found some functions that I missed:

  • CCFloat.round : float -> float – a version that returns an int would also be useful
  • CCVector.append_gen : 'a CCVector.vector -> 'a gen -> unit
  • CCList.{first, last} : 'a list -> 'a option
  • CCHashtbl.{to_gen, values_gen, keys_gen} – I guess these can't be implemented without using an intermediate list. They would still be nice to have so that I don't need to update my code when the standard library provides a more efficient way to implement them
@c-cube
Copy link
Owner

c-cube commented Sep 25, 2016

I implemented everything but the Hashtbl functions. It's indeed not efficiently implementable, and it's not much more verbose to write CCHashtbl.values_list |> Gen.of_list, which at least makes the cost explicit; even if/when the stdlib starts providing efficient versions, it will not be portable, so I'd advise to use Sequence for now.

Feel free to re-open if you disagree, I'm not totally opposed to it :-)

@c-cube c-cube closed this as completed Sep 25, 2016
@copy
Copy link
Contributor Author

copy commented Sep 27, 2016

Feel free to re-open if you disagree, I'm not totally opposed to it :-)

No, I agree with your reasoning.

Thanks for implementing the functions!

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