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
Adding "Queue.iteri" and "Queue.foldi" functions to the standard library. #1544
Conversation
I would not do this without first benchmarking to measure the performance impact. For example, it is possible to compute the maximal value of a queue of non-negative integers with (For many libraries I would agree that removing redundancy of implementation is a good choice, but standard libraries actually get to decide to be a bit less pleasant within if they can speedup the programs of their users in practically relevant ways.) |
I've added now tests for both of the added functions. If a more comprehensive testing is needed, I can expand them further.
I've made some micro-benchmarks for
E.g., if
then the new
It is up to you to decide. I have split the original commits so that if you say that if it is absolutely unacceptable to degrade the performance of the original |
Co-authored-by: Christine Rose <christinerose@users.noreply.github.com> Co-authored-by: Thibaut Mattio <thibaut.mattio@gmail.com>
This PR attempts to:
Queue.iteri
Queue.foldi
Queue.iter
andQueue.fold
functions in terms of the above "indexed variants"Queue.iter
andQueue.fold
in order to make the description more concrete (i.e. more likeList.iter
andList.fold_left
).