From: Martin DeMello Date: 2003-08-01T05:03:26+09:00 Subject: Re: Changing ==,>,<, etc Mark Wilson wrote: > > On Thursday, July 31, 2003, at 02:22 PM, Nathan Weston wrote: > >> [snip] >> And all was well. But then I hit a snag: >> # 1 < any(1,2,3) >> ERR: (eval):1:in `<': Disjunction can't be coerced into Fixnum >> >> [snip some very interesting questions I intend to think about.] > > What you want can be done with the any? method for arrays. > > [1, 2, 3].any? { |e| 1 < e } > > There's also an all? method. any? and all? are very receiver-centric - compare a.any? {|i| b.all? {|j| i < j} } with any(a) < all(b) The latter shows up the symmetry a lot more clearly - I've always hated having to write nested loops to express something flat. martin