From: James Gray Date: 2008-05-02T21:28:32+09:00 Subject: Re: Extracting a value from an array On May 2, 2008, at 5:07 AM, Arlen Cuss wrote: > Hi, > > On Fri, May 2, 2008 at 7:34 PM, 7stud -- > wrote: > >>> I've compressed your loop into this: >>> >>> (headers.select{ |h| h[:name] == 'content-length' }.first)[:value] >> >> That seems pretty typical of ruby programmers: cram everything into >> one >> line and call it "clear". >> > > It's still done in a very neat fashion, and the one that makes the > most > sense from a functional programming point of view. Well, the find() iterator makes the most sense, I would say. select().first() is just a hand-rolled find() that's slower to run and takes more memory, of course. ;) The archives should give readers plenty of evidence regarding how much attention should be given to 7stud's Ruby opinions though. James Edward Gray II