From: Tim Pease Date: 2007-08-04T03:33:08+09:00 Subject: Re: Running multiple closures per iteration On 8/3/07, Joshua Chia wrote: > Joel VanderWerf wrote: > > Did you mean > > > > o = a.select {|x| x >= 0} > > p = o.inject(0) {|s, x| s += x} > > ^^^ > > ? > > > > No, I meant to compute two different things from a. Well, it's not pretty, but here's my best shot at it o, p = a.inject( [[], 0] ) do |ary,x| ary[0] << x if x >= 0 ary[1] += x ary end I don't think Ruby natively supports such a creature, though. Please correct me if I'm wrong. Blessings, TwP