From: Hugh Sasse Staff Elec Eng Date: 2001-06-19T01:19:08+09:00 Subject: [ruby-talk:16591] RCR: Enumerable: every() and none() I've been off the list for a while but I'm dipping back in to suggest: Enumerable should have functions every and none to complement find_all and reject. I think it is likely that people will want to know if all the things in the enumObj match or all don't match the conditions specified by block. So: def every(&block) find_all(&block) == to_a() end def none(&block) reject(&block) == to_a() end I have come up against this when trying to define a fuzzy set which might be constructed by defining the corners of a trapezoid, or might be constructed by passing a whole collection of trapezoids to the constructor. I want to be sure when def initialize(*params) [...] end that EVERY *params is numeric, or that EVERY *params is a trapezoid.... I submit that this is generalized enough and useful enough to merit inclusion in ruby, hence my proposing this RCR. There may be a more efficient way to implement this than with the above code, so that is intended only as a description of functionality. I hope this is a useful suggestion. Hugh hgs@dmu.ac.uk