On Monday, November 29, 2004, 1:57:50 PM, itsme213 wrote:

>>   Array#only
>>     [5].only      -> 5
>>     [1,2,3].only  -> exception

> I prefer: Array#one
> to be complemented by
> Array#one? #{|e| predicate(e)}  true if exactly one match

> and rounded out by
Array#any #=>> return a random element, like Array#any?
> Array#none # with addition of Array#none? {|e| predicate(e)}
Array#all #=>> of questionable value

> and separately
> Array#include_all? (other_enumerable)

#any? and #all? are methods of Enumerable, not Array.  I like the idea
of Enumerable#one? and Enumerable#none? to complement them.

But I don't think Enumerable#one? and Array#one are complementary;
they seem entirely different.

Likewise with Array#any: it's useful, but really has nothing to do
with #any?  I'm implementing Array#rand, by the way.

Regarding Array#include_all?, you might want to look at Set.

Cheers,
Gavin