Skip to content
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

AllTrue / AllFalse return True for empty lists #4940

Closed
andydandy74 opened this issue Jul 17, 2015 · 3 comments
Closed

AllTrue / AllFalse return True for empty lists #4940

andydandy74 opened this issue Jul 17, 2015 · 3 comments

Comments

@andydandy74
Copy link
Contributor

Shouldn't AllTrue / AllFalse return false when passed an empty list? I think they should only return true if the list contains at least one item (and if all items in the list satisfy the condition, of course).
listemptyallfalsetrue

@andydandy74 andydandy74 changed the title AllTrue / AllFalse returns True for empty lists AllTrue / AllFalse return True for empty lists Jul 17, 2015
@jnealb
Copy link
Collaborator

jnealb commented Jul 17, 2015

@andydandy74 Thanks - this is tracked with MAGN-7932.

@ke-yu
Copy link
Contributor

ke-yu commented Jul 22, 2015

@andydandy74,, @jnealb , that's expected.

May I say that "all items are true" (AllTrue) is logically equivalent to "there is no item which is false" (Not (SomeFalse)). Now consider an empty list. Obviously, as no item in an empty list, SomeFalse should return false, so Not (SomeFalse) returns true, thenAllTrue returns true. Similarly for AllFalse.

So although at the first glance it is weird that both AllTrue and AllFalse return true for an empty list, but that's expected.

@andydandy74
Copy link
Contributor Author

Thanks for clarifying that, @ke-yu - I guess I'll just have to make a custom AllTrue/AllFalse node that checks against List.IsEmpty beforehand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants