-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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: Implementation of deleteat! (Fixes #5118) #5176
Conversation
How about calling this operation |
#bikeshed |
After thinking about it, I kind of like the parallels with |
If we had Like all of these things, it's easy to get carried away. |
You should document the need for a sorted iterable. Why only sorted anyway? I see that it is good for performance, but could we have a slow fallback instead of an error? |
The abbreviated |
This was the easiest way to implement the function without worrying about explicitly storing/copying/modifying the iterable. That version currently starts to modify the array immediately on iteration through the indices, so if something is out of order, it's not possible to undo the changes already made. I don't think it's possible to have a slow fallback without considerably slowing down the fast version. If we want a version which checks the input order, we might as well always copy/collect and sort it and get rid of this version. It does need documentation, though, if it doesn't change. |
Just so I'm clear, it's the
Okay, I can certainly change it to |
Right, it's the |
This strikes me as a lot of repeated code from |
I refactored one of the BitArray versions, but the rest didn't jump out as On Monday, December 16, 2013, Jeff Bezanson wrote:
|
Okay, factored out common code between |
bump. @JeffBezanson, @ViralBShah? thoughts on this operation? |
I'm cool with this and it is still mergeable. |
Implementation of deleteat! (Fixes #5118)
As noted in #5118,
delindex!
was previously proposed but never implemented. Here is an implementationdelindex!deleteat!
forRange1
delindex!deleteat!
is more efficient thansplice!
when the items being removed from the collection are not needed and returning them is costly.This PR also changes/fixes the return type of one of the
splice!
implementations forBitArrays
, which was returning the modified array instead of the spliced-out region. cc:@carlobaldassiEdit: changed name from
delindex!
todeleteat!
.