From: RichardOnRails Date: 2011-05-28T23:00:27+09:00 Subject: Re: Problem in using %:whatever in enumumerations On May 28, 2:20 am, Victor Deryagin wrote: Thanks for your response. > > greek = %w{Alpha Beta Gamma} > > puts greek.all? { |s| s.length == 5 }              #  (correct)  => false > > puts greek.all? { |s| (4..5).include? s.length }   #  (correct)  => true > > puts greek.all?(&:length)                      #  (programmer error)     => true > ... If that's not what you want (e.g. you need { |s| s.length == 5 }) - > construct block yourself. I did construct the block myself in the first couple of examples (lines 2 & 3) but was searching (in line 4) for another way of expressing the requirement. I finally found a way to use a lambda in the following statements in place of line 4: lam = lambda { |item, len| item.length == 5 } puts greek.all? { |s| lam.call(s,5)} # (correct) => false Of course, the verbosity of this pair of statements is unsatisfying, so I'm still searching for succinct alternatives. Best wishes, Richard