Michael Neumann <neumann / s-direktnet.de> writes:

| Dan Schmidt wrote:
| > Am I reimplementing a wheel that already exists?  Can this be implemented
| > (or designed) better?  Is this a useful enough concept to consider putting
| > something like it in the core library?  Is it a monstrosity of codesize
| > optimization, creating ugly and unreadable code?
| 
| Why not just use Enumerable#collect ?
| This should work:
|   id, name, height, weight, potato = $~[1..5].collect {|i| i.to_i }

Because I want to apply different methods to each member of the
array.  Only elements 0, 2, and 3 should have to_i sent to them, and
elements 1 and 4 should be left alone.

-- 
http://www.dfan.org