On Fri, Sep 5, 2008 at 9:29 AM, Lars Christensen <larsch / belunktum.dk> wrote: > On Sep 5, 7:34 am, "Eric I." <rubytrain... / gmail.com> wrote: >> On Sep 4, 9:40 pm, RichardOnRails >> > Any ideas/suggestions? >> >> Here's one solution that requires the 'permutation' gem: > > Ruby 1.8.7 and 1.9 has Array#permutation: > > (3..7).to_a.permutation.sort_by { |a| a[0..2].to_s.to_i * > a[3..4].to_s.to_i }.first > > Golf anyone? :-) (i) A trivial trick is to replace (3..7).to_a with [*3..7] (ii) sort_by( &blk ).first can be replaced with min_by( &blk ) R -- C'est vñÓitablement utile puisque c'est joli. Antoine de Saint ExupñÓy