From: "Aaron D. Gifford" Date: 2011-12-01T05:14:10+09:00 Subject: Re: Stupid question On Wed, Nov 30, 2011 at 1:03 PM, Dave Aronson wrote: ... > Yup, inject was part of what I was thinking.  The other half is map. > Result, using chars: > >  "2011".chars.map(&:to_i).inject(&:+) > > Can anyone make that even shorter?  Let's play Ruby Golf!  ;-) > > -Dave If we're golfing, here's my amateur golf attempt: *chuckle* s=0;'2011'.chars{|x|s+=x.to_i};s (Are we allowing semicolons?) Aaron out.