From: tomsonp@... (Phil Tomson) Date: 2005-10-20T03:56:58+09:00 Subject: Re: Functional with Ruby In article <8759.1129747265@www88.gmx.net>, Andreas Semt wrote: >Hello list, > >here a really simple Haskell function, which sums all elements of a list >(from the book "The Haskell School of Expression"): >-------------------------------- >listSum [] = 0 >listSum (x : xs) = x + listSum xs >-------------------------------- > >Which is the best way to say it in Ruby (functional style)? Don't use >'enum.inject', please! > Ummm, why wouldn't we be able to use inject? I was under the impression that inject was the functional way to do it in Ruby. Phil