From: Dave Thomas Date: 2000-02-14T23:27:19-06:00 Subject: [ruby-talk:01368] Re: nice sample for functional stuff gotoken@math.sci.hokudai.ac.jp (GOTO Kentaro) writes: > That is not bad though, I was interested in how I can sum up the > non-numerical elements. The solution above uses an assumption such > that the result is 0 if enum.size == 0 but [ruby-talk:01364] doesn't. > > # And, I wanted simply to use `callcc' then ;-) Both are excellent points! Although you can always use the raw .inject method to overcome the first objection: p ['foo', 'bar', 'baz'].inject("") {|n,i| n += i} p [].inject("all gone") {|n,i| n += i} But yours is certainly a more interesting solution. Thanks! Dave