From: Robert Dober Date: 2007-02-12T21:23:52+09:00 Subject: Re: [SOLUTION] One-Liners (#113) ------=_Part_63265_4846323.1171283029657 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/12/07, James Edward Gray II wrote: > > > When I built the quiz, I used the following solutions to reality- > check myself. (Making sure I could find a viable answer.) > > quiz.inject(Array.new) { |arr, a| arr.push(*a) } > > # > # Convert an Array of objects to nested Hashes such that %w[one two > three four > # five] becomes {"one" => {"two" => {"three" => {"four" => "five"}}}}. > # > quiz.reverse.inject { |res, wrap| {wrap => res} } > > James Edward Gray II Applying your genius to your genius we get for the flat_flatten problem quiz.inject{|arr,ele| [*arr].push(*ele)} maybe you prefer your original solution but I feel the second one is just great too. Cheers Robert -- We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous ------=_Part_63265_4846323.1171283029657--