change call scheme for any
and all
for AbstractArray
#55671
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes three changes to the way
any
andall
calls are transformed into 3-argument_any
and_all
calls 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 implementany
for a customAbstractArray
type, 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
f
for the 2-argument versions ofany
andall
be of typeFunction
has been removed. None of the other methods for the 2-argument versions ofany
andall
impose this, and I see no reason to have it here.I've deleted the explicit definitions of the 2-argument versions of
_any
and_all
. They are covered by the following linejulia/base/reducedim.jl
Line 1007 in 39f2ad1
in the
for
loop a few lines later. (I believe that it doesn't matter anyway. As far as I can tell, the 2-argument_any
and_all
were only used for the 1-argumentany
andall
and nowhere else.)