julia
20940e32 - change call scheme for `any` and `all` for `AbstractArray` (#55671)

Commit
47 days ago
change call scheme for `any` and `all` for `AbstractArray` (#55671) This PR makes three changes to the way `any` and `all` calls are transformed into 3-argument `_any` and `_all` calls for `AbstractArray`: - `any(a)` is transformed to `any(identity, a)` instead of calling 2-argument `_any`, and analogously for `all`. I think this has the following advantage: If somebody wants to implement `any` for a custom `AbstractArray` type, then it is now enough to define the 2-argument `any`. Currently also the 1-argument version has to be defined explicitly. - The restriction that the predicate `f` for the 2-argument versions of `any` and `all` be of type `Function` has been removed. None of the other methods for the 2-argument versions of `any` and `all` 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 line https://github.com/JuliaLang/julia/blob/39f2ad1e941fd092b906d60e8d23c004e8ee5b7e/base/reducedim.jl#L1007 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-argument `any` and `all` and nowhere else.) Co-authored-by: Andy Dienes <51664769+adienes@users.noreply.github.com>
Author
Parents
Loading