-
-
Notifications
You must be signed in to change notification settings - Fork 703
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
[std.algorithm.searching] Add extrema to compute min and max #8727
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request and interest in making D better, @ntrel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + phobos#8727" |
@atilaneves This is a new public function |
Unlike the naive version done where? |
https://dlang.org/phobos/std_algorithm_iteration.html#fold
|
Do you mean |
@atilaneves |
@ntrel @atilaneves how do we move further with this? |
I still don't know what this is a replacement for. |
When a user wants to compute the min and max value of a range with Phobos, currently they need to call |
* r = The range to traverse. | ||
*/ | ||
// TODO alias map = a => a | ||
ElementType!Range[2] extrema(Range)(Range r) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explicit ElementType!Range
makes me wonder what happens when the elements are const
, immutable
, or shared
.
Performs
< 3n/2
comparisons, unlike the naive< 2n
.Implemented for an input range.
TODO add
alias map = a => a
parameter, once design is confirmed OK.