-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
any() and all() functions broken for empty collections #18073
Comments
Update: This is actually an inconsistency between These two argument forms return the expected result in the case of an empty collection:
|
FWIW julia> all(Bool[])
true
julia> any(Bool[])
false |
@yuyichao |
Similar issue exists for |
I guess |
@dbeach24, no, that would destroy type-stability of the Let's keep this issue focused on the case at hand. |
@stevengj Thanks for the background. (Deleting my earlier comment as it is not pertinent to this issue.) |
Add default (true/false) argument to reduce argument so that any([]) == false and all([]) == true. (Previously these raised an exception due to reducing an empty list.)
fix JuliaLang#18073: `any([])` and `all([])` (JuliaLang#18105) (cherry picked from commit d259be5)
Julia raises an exception when invoking the
any()
andall()
functions with empty collections.In Julia 0.5.0-RC2, I get:
The behavior I would expect:
Note that this behavior is generally useful in most logic programming and matches Python:
The text was updated successfully, but these errors were encountered: