-
Notifications
You must be signed in to change notification settings - Fork 553
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
[RFC] Add 'Sequence::isSorted'. #900
Comments
I agree that an |
A Sequence can be sorted despite the fact there is no sorting infrastructure, in particular I think about |
Yes, Range would require special treatment in #899 too as there's no point iterating through it when the elements are distinct by definition. |
BTW, ranges can optimize more function, such as |
Good point. I'd expected that |
It does not. I'm working on a PR right now for that and some more. Edit: Namely:
|
|
Never optimize based on internal details, nor before you measured. |
I agree with that maxim up to a point but, if I know something is bad and it's almost as easy to do something that isn't (a simple boolean expression here), I find it difficult to make my fingers type the former. |
It's surprisingly hard to calculate the size of a range 😸. |
@PureFox48 I don't know if you'd thought about that, but @ruby0x1 Do it seems correct to you to break the current behavior and instead just make |
Yes, I did know that range elements are not necessarily integral though it's not really a problem for me as my ranges almost invariably are integral and the value I'm checking for is also integral. Rather than override |
Maybe, but that's for another PR. |
Out of original topic but should be something like:
|
Already sent a PR: #901. |
While discussing for #899, it became apparent that #802 lacks test to code that a Sequence is sorted. Basically it means adding:
The text was updated successfully, but these errors were encountered: