From: nobu.nokada@... Date: 2003-02-28T06:39:45+09:00 Subject: Re: 'each' returning array Hi, At Fri, 28 Feb 2003 06:01:31 +0900, Wojciech Kaczmarek wrote: > Is there a way to transparently accumulate expresions evaluated within > a block into an array, without introducing an external variable? For > example, I'd like to write something like this: > > "HAL".each_byte__returning_array {|x| (x+1).chr} .collect # more processing Enumerator in "rough". require "enumerator" "HAL".enum_for(:each_byte).collect {|x| (x+1).chr} # => ["I", "B", "M"] -- Nobu Nakada