-
Notifications
You must be signed in to change notification settings - Fork 367
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
$.uniq doesn't retain order #118
Comments
The order is not guaranteed as few things can happen. If order is important then either it is sorted and returned, or it is returned in the order it was passed. |
This is what I would expect to happen but that doesn't currently happen. Order isn't kept for If you think |
Also thanks for a great library. It covers off so many things that should be standard in Swift. |
Yes adding it as an option makes sense as underneath it is using dictionary keys and returning that which are uniq but the order is ignored for speed. |
Now the other thing to figure out is what is the order if there are duplicate values as such [Stockholm, SE, Stockholm] |
Should it be [Stockholm, SE] or [SE, Stockholm]. The question is should we pick the last uniq value and its order or pick the first and use that order. |
I think So You were talking about performance which is great. Would the optional be something like this:
The question is would order preservation be turned on or off by default? I'd be interested to know what you think, but my opinion is it would be better to keep
Are there other instances where you've had to decide on speed vs accuracy? If so which did you pick? |
Thanks heaps @ankurp! |
No problem. |
Outputs
It should output
The text was updated successfully, but these errors were encountered: