On Wed, Nov 30, 2011 at 1:03 PM, Dave Aronson
<rubytalk2dave / davearonson.com> wrote:
...
> Yup, inject was part of what I was thinking. =A0The other half is map.
> Result, using chars:
>
> =A0"2011".chars.map(&:to_i).inject(&:+)
>
> Can anyone make that even shorter? =A0Let's play Ruby Golf! =A0;-)
>
> -Dave

If we're golfing, here's my amateur golf attempt:  *chuckle*

s=3D0;'2011'.chars{|x|s+=3Dx.to_i};s

(Are we allowing semicolons?)

Aaron out.