From: "alexeymuranov (Alexey Muranov)" Date: 2013-08-03T05:22:19+09:00 Subject: [ruby-core:56343] [CommonRuby - Feature #8723] Array.any? predicate returns true for empty array. Issue #8723 has been updated by alexeymuranov (Alexey Muranov). nurettin (Nurettin Onur TUGCU) wrote: > Yes, I meant for .all? (wasn't able to edit) and the behavior is correct according to docs, and incorrect according to my interpretation of sets. (can a predicate be true when you have empty set?) [].any? { |x| predicate(x) } means in human/mathematical language: "there exists x in [] such that predicate(x) is true", this is false because there are not elements in []. [].all? { |x| predicate(x) } means: "for every x in [], predicate(x) is true", this is true because there are not elements in []. If you have no children, it is true that all your children are redhead. ---------------------------------------- Feature #8723: Array.any? predicate returns true for empty array. https://bugs.ruby-lang.org/issues/8723#change-40836 Author: nurettin (Nurettin Onur TUGCU) Status: Rejected Priority: Normal Assignee: Category: Target version: Are all your children redheaded? Would this be true if you have no children? I have no children, therefore none of my children are redheaded. Therefore [].any?{ true } == true makes no sense. Expected behavior: [].any?{ true } == false because the array is empty. -- http://bugs.ruby-lang.org/