On 2007-11-27 09:24 +0900 (Tue), Alex Young wrote:

> rbysamppi / gmail.com wrote:
> >Are there any more elegant, concise, pithy, and more Rubyish ways of
> >doing this?...
> 
> The Incredible Inevitable Inject:...

If you're interested in pursuing the study of elegance this direction,
you might consider procuring and working through a copy of _The
Little Schemer_, perhaps followed by some playing with the Haskell
list-manipulation functions.

Ruby is quite amenable to many of the same techniques, with a couple
of caveats. The minor one is that it that it tends towards Smalltalk
idioms, such as inject instead of fold (or perhaps it's just me when I'm
using Ruby). The bigger one is the lack of tail recursion, which has
bitten me more than a few times.

cjs
-- 
Curt Sampson       <cjs / starling-software.com>        +81 90 7737 2974   
Starling Software     <office-admin / starling-software.com>
Mobile sites and software consulting: http://www.starling-software.com