-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
change call scheme for any and all for AbstractArray
#55671
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
base: master
Are you sure you want to change the base?
Conversation
|
This change looks like a great idea! I don't fully understand (yet) why |
|
Do you want to move forward with this? If yes, do you want changes for other reduction function to be part of the same PR or separate? (I would prefer the second option.) |
|
It's probably better to do these separately |
|
I see the |
e23752e to
b4c69a3
Compare
|
I would say it's still needed. I've just rebased it. |
|
just for posterity & to preserve the discussion, I assume this PR is motivated by #9498 (comment) ? |
No, it is motivated by my experience with developing SmallCollections.jl. The |
This PR makes three changes to the way
anyandallcalls are transformed into 3-argument_anyand_allcalls forAbstractArray:any(a)is transformed toany(identity, a)instead of calling 2-argument_any, and analogously forall. I think this has the following advantage: If somebody wants to implementanyfor a customAbstractArraytype, then it is now enough to define the 2-argumentany. Currently also the 1-argument version has to be defined explicitly.The restriction that the predicate
ffor the 2-argument versions ofanyandallbe of typeFunctionhas been removed. None of the other methods for the 2-argument versions ofanyandallimpose this, and I see no reason to have it here.I've deleted the explicit definitions of the 2-argument versions of
_anyand_all. They are covered by the following linejulia/base/reducedim.jl
Line 1007 in 39f2ad1
in the
forloop a few lines later. (I believe that it doesn't matter anyway. As far as I can tell, the 2-argument_anyand_allwere only used for the 1-argumentanyandalland nowhere else.)