From: gotoken@... (GOTO Kentaro) Date: 2001-01-08T04:40:17+09:00 Subject: [ruby-talk:8781] Re: No :<, :>, etc. methods for Array In message "[ruby-talk:8780] Re: No :<, :>, etc. methods for Array" on 01/01/08, "Brian F. Feldman" writes: >class Array > def sum > total = self[0] # defaults to nil > self[1..-1].each {|x| total += x} > total > end >end > >It simplifies lots of things (especially mathematics) in Ruby to have it, >and I believe it's generally useful enough that it should probably be >standard. What do you think? See: http://www.rubycentral.com/faq/rubyfaq-11.html#ss11.4 `Enumerable#inject' is introduced there. That may be adopted if an apter method name is proposed. -- Gotoken