From: Michael Fellinger Date: 2006-12-03T00:58:50+09:00 Subject: Re: [OT] calculations on lists of numbers On 12/2/06, Paul Lutus wrote: > Joel VanderWerf wrote: > > > puts "#{sum} #{mean} #{array.min} #{array.max}" > > I'm not much into golf, but, since we've long since left the clubhouse, and > because I am very lazy: > > puts [ sum,mean,array.min,array.max ].map { |v| v.to_s }.join(' ') puts [ sum, mean, array.min, array.max ].join(' ') just cause join calls .to_s on every element anyway ;) > > This has the sole advantage that particular elements can be added and > removed without a lot of typing. If no one expects to change the program, > then there's no point in it. > > -- > Paul Lutus > http://www.arachnoid.com > >