Skip to content

Conversation

@MasonProtter
Copy link
Contributor

Closes #39470

@kshyatt kshyatt added the iteration Involves iteration or the iteration protocol label Feb 6, 2021
@kshyatt
Copy link
Member

kshyatt commented Feb 6, 2021

Could doc strings be added for this? Otherwise lgtm

@kshyatt kshyatt added arrays [a, r, r, a, y, s] needs docs Documentation for this change is required labels Feb 6, 2021
@kshyatt kshyatt requested review from kshyatt and rfourquet February 6, 2021 16:28
kshyatt
kshyatt previously requested changes Feb 6, 2021
Copy link
Member

@kshyatt kshyatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With docs this should be good to go I think

@MasonProtter
Copy link
Contributor Author

Done! I also added a NEWS.md entry. Let me know if the descriptions need tweaking.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a reference to this into doc/src/base/arrays.md

@vtjnash vtjnash added forgetmenot and removed needs docs Documentation for this change is required labels Apr 16, 2021
@MasonProtter
Copy link
Contributor Author

MasonProtter commented Apr 16, 2021

I can add this to doc/src/base/arrays.md, but maybe it'd fit better in doc/src/base/collections.md as that is where filter! is?

@vtjnash
Copy link
Member

vtjnash commented Apr 16, 2021

yeah, that sounds good

@vtjnash vtjnash added merge me PR is reviewed. Merge when all tests are passing and removed forgetmenot labels Apr 16, 2021
"""
function mask!(a::AbstractVector, m::AbstractVector{Bool})
j = firstindex(a)
for i in eachindex(a, m)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q for anyone: is eachindex and nextind / iterate guaranteed to be in the same visit order?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfourquet
Copy link
Member

Shouldn't we unify the names with keepat! from #36229? For consistency with deleteat! which accepts either a mask or indices. I think mask! wouldn't work as a name for the keepat! functionality, would keepat! work as a name for the mask! functionality?

@musm
Copy link
Contributor

musm commented Apr 28, 2021

Shouldn't we unify the names with keepat! from #36229? For consistency with deleteat! which accepts either a mask or indices. I think mask! wouldn't work as a name for the keepat! functionality, would keepat! work as a name for the mask! functionality?

Good point to bring this up. Are these two PRs stalled on bikeshedding a name?

@simeonschaub simeonschaub added triage This should be discussed on a triage call and removed merge me PR is reviewed. Merge when all tests are passing labels Apr 28, 2021
@simeonschaub
Copy link
Member

Removing merge me label and marking for triage since it looks like there still has to be a definite decision made on the name.

@oxinabox
Copy link
Contributor

oxinabox commented May 27, 2021

Is the reason we want this just because deleteat!(xs, .!mask) is to expensive because flipping the mask?

@oscardssmith
Copy link
Member

triage says keepat!

@oscardssmith oscardssmith added forgetmenot and removed triage This should be discussed on a triage call labels May 27, 2021
@vtjnash vtjnash changed the title add mask! for in-place logical filtering add keepat! for in-place logical filtering May 27, 2021
@MasonProtter
Copy link
Contributor Author

Okay, I'll amend the PR with the new name, sorry I couldn't make the Triage call.

@rfourquet
Copy link
Member

@MasonProtter did you close this by inadvertently?

@StefanKarpinski
Copy link
Member

Reopened in case. Can close again if it was on purpose.

@MasonProtter
Copy link
Contributor Author

I closed this because #36229 was merged, which is the exact same thing, right? I didn’t realize they were doing the same thing until yours was merged @rfourquet or I wouldn’t have opened this one in the first place.

@vtjnash vtjnash reopened this Jun 18, 2021
@vtjnash
Copy link
Member

vtjnash commented Jun 18, 2021

I believe they do different, but complimentary things

@rfourquet
Copy link
Member

Yes IIRC, the method from the other PR was receiving indices, while this one here receives a boolean mask.

@MasonProtter
Copy link
Contributor Author

MasonProtter commented Jun 18, 2021

🤦 well im glad you paid closer attention than I did!

Should these be methods of the same function, or different functions?

@oscardssmith
Copy link
Member

Triage decided on different methods a few weeks ago when we discussed this. The reason is that deleteat has methods for both.

@bkamins
Copy link
Member

bkamins commented Sep 7, 2021

will this get 1.7 label? I would like to add keepat! to JuliaLang/Compat.jl#750 and it would be great to know what contract it will support in 1.7. Thank you!

@MasonProtter
Copy link
Contributor Author

Superseded by #42351

@MasonProtter MasonProtter deleted the filter_mask branch October 30, 2024 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrays [a, r, r, a, y, s] iteration Involves iteration or the iteration protocol

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inplace mask of vector

10 participants