On Thu, Aug 10, 2006 at 01:41:48AM +0900, Andre Nathan wrote:
> Hello
> 
> I found this to be somewhat amusing:
> 
> >> a = []
> => []
> >> a.all?
> => true
> >> a.all? { |i| i == 10 }
> => true
> 
> Is there any reasoning for Enumerable#all? to always return true for
> empty arrays?

a.all?{ ... }   == true

can be read as "All elements in a satisfy { ... }", which we can interpret as
"there is no element in a such that { ... } is not satisfied", which is
obviously true if a is empty.

-- 
Mauricio Fernandez  -   http://eigenclass.org   -  singular Ruby