-
Notifications
You must be signed in to change notification settings - Fork 312
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
Implement a free sorted_unstable
#796
Conversation
- based on free `sorted`
It surely seems legitimate. But I don't know what is our policy about "free" functions yet. |
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.
@chris-ha458, can you say a little bit about why you need this to be a free function? Why is the existing method not adequate?
It definitely is not a "need" but a "nice to have". I'm not finding the specific snippet of code right now but it looks a bit like this.
This is a small contrived example, but i think you can see how it could be useful.
With my PR it could follow the above
This proposed change is minor and not critical. However, it could enhance the functionality in scenarios involving functional chaining, tail calls, maps, and closures. While introducing additional code increases maintenance complexity, only looking at the immediately related sections of the code, the simplicity of this change does not seem to significantly add to that burden. I understand that this PR may be closed for various reasons. Nonetheless, explanations for closing or prerequisites for merging would be beneficial, if only for documentation purposes. |
I think the note is that you could use https://docs.rs/itertools/latest/itertools/trait.Itertools.html#method.sorted_unstable to write fn process_vec(mut input: Vec<String>) -> Vec<String> {
input.push("1".to_string());
// other processing steps
input.into_iter().sorted_unstable()
} without a free function, while still moving it. But it's certainly true that if https://docs.rs/itertools/latest/itertools/fn.sorted.html was apparently decided to be worth having at some point, it's hard to say why a |
I agree with all of your points. If that were the case it would be easy to reject this one. First of all, python does not offer a I don't think this is a problem, hence authoring the PR but I could definitely understand anybody that does.. |
It's either Edit: About free functions, I found that interesting. |
Would it be possible to merge this?