From: David MacMahon Date: 2013-08-03T06:03:06+09:00 Subject: [ruby-core:56344] Re: [CommonRuby - Feature #8723] Array.any? predicate returns true for empty array. Just for fun... # true regardless of whether [].all? returns true or false [].all? { |x| predicate(x) } == [].all? { |x| !predicate(x) } # true iff enum is empty, but false otherwise enum.all? { |x| predicate(x) } == enum.all? { |x| !predicate(x) } # Q: If enum.all? is true, can enum.any? be false? # A: Yes, if enum is empty. (This is arguably non-intuituve. IMHO.) if enum.all? { |x| predicate(x) } && !enum.any? { |x| predicate(x) } puts "enum is empty" end True statement 1: All of my pets are dogs. True statement 2: None of my pets are dogs. Conclusion: I have no pets. True statement 1: All of my pets are dogs. True statement 2: All of my pets are cats. Conclusion: I have no pets. Dave