------ art_64358_14734948.1171288722152 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/12/07, Eric I. <rubytraining / gmail.com> wrote: > > On Feb 12, 1:07 am, "Phrogz" <g... / refinery.com> wrote: > > On Feb 11, 4:40 pm, Alex Young <a... / blackkettle.org> wrote: > > > > > # One-level flatten(). > > > r ;quiz.each{|a|r+ a]};r > > > > Elegantly small! > > When I saw that, I thought that it could definitely be shortened by > using an inject. After all, there'd be no assignments of r, no final > returning of r, no semicolons. But when all was said and done, it > ended up being the same length. Compare: > > quiz.inject([]){|r,a|r+[*a]} > r ;quiz.each{|a|r+ a]};r > > Oh well.... > > Eric Comparing this with James' solution we can it down to quiz.inject{|r,a|[*r]+[*a]} I think this quiz is just lovely!!! Robert ---------------- > Are you interested in on-site Ruby training that uses well-designed, > real-world, hands-on exercises? http://LearnRuby.com > > > -- 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 ------ art_64358_14734948.1171288722152--