------art_9631_25107187.1213270715403
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Thu, Jun 12, 2008 at 3:27 AM, Robert Dober <robert.dober / gmail.com>
wrote:

> On Thu, Jun 12, 2008 at 9:15 AM, Sebastian Hungerecker
> <sepp2k / googlemail.com> wrote:
> > Rick DeNatale wrote:
> >> [1,3,5].inject([]) {|s,e| s  .to_a; s << e + ( s.last || 0)}
> >
> > If you're okay with 0 being inside the result array you can also do:
> > [1,3,5].inject([0]) {|s, e| s << s.last + e}
>
> and if you are not
>
> [1,3,5].inject([0]){| a, e| a<< a.last + e}[1..-1]


Which I had in my original offering before Sebastien trimmed it. <G>

-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

------art_9631_25107187.1213270715403--