From: Robert Klemme Date: 2004-07-05T16:42:40+09:00 Subject: Re: Transforming... "Meino Christian Cramer" schrieb im Newsbeitrag news:20040705.091922.03982506.Meino.Cramer@gmx.de... > From: "Gavin Sinclair" > Subject: Re: Transforming... > Date: Mon, 5 Jul 2004 16:07:19 +0900 > > Hi Gavin, > > whow! what a fast reply ! Thank you very much ! :) > > I want an algorithm, which when applied like this > > b= > > it does the same as I would do this by hand: > > b=[[,,],[,,],[,,]] That's exactly what Gavin gave you. What are you after? robert > > > > > Meino wrote: > > > > > In my program there is a hash of this form > > > > > > a={ "" => [,,], > > > "" => [,,], > > > "" => [,,] > > > } > > > > > > I am looking for a short and handy way to produce an array out of > > > this, which looks like: > > > > > > b=[[,,],[,,],[,,]] > > > > > > without iterating over the hash. > > > > I presume you mean you just want an array of the *values* in the hash? > > > > b = a.values > > > > If you want the values sorted according to the order of the keys: > > > > b = a.keys.sort.map { |k| a[k] } > > > > Cheers, > > Gavin > > > > > > > > > > > >