From: dblack@... Date: 2006-11-21T13:50:17+09:00 Subject: Re: array question Hi -- On Tue, 21 Nov 2006, Daniel N wrote: > On 11/21/06, Daniel N wrote: >> >> Sorry missed a brace on the block. Should be > > b = a.inject( [] ) { |a,e| a << [e,e]}.flatten[1..-2] } I so much think it's time for flatten to take an argument, specifying number of levels to flatten. My flattenx extension does this, and it seems like a natural fit for flatten itself. Otherwise almost all flatten-based techniques run the risk of over-flattening. David -- David A. Black | dblack@rubypal.com Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3] DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4] [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com [2] http://dablog.rubypal.com | [4] http://www.rubycentral.org