From: wsdng@... (=?ISO-8859-1?Q?Sascha_D=F6rdelmann?=) Date: 2003-07-24T17:52:19+09:00 Subject: Re: A different Version of Enumerable#inject "Robert Klemme" wrote about: [ inject with variable num args block ] My first thought was that inject is complex enough as it is and more features might prevent me from using it. My second thought was: Why restrict this feature to inject? But I still see some problems, too. I don't use inject very often. (Reason: I always have to look up which argument of the block was the result of last steps and which one was the next entry of my enumerable. More arguments won't help me there. ;-) But I often need to do things between two steps of an iteration (do:separatedBy: in Smalltalk) or do things with two adjacent entries (pairsDo: in Smalltalk). As you see my problem is method naming. I tend to expect differently named methods for different tasks and not one method or block doing different jobs depending on the number of arguments. IMO the first argument of inject is meant to carry the information from the steps already done (e. g. a computational result) into the next iteration step. Each iteration step gets this information plus the next entry of my collection. The carried information could contain all the needed informations about previous steps (e. g. a fifo-list holding some entries). From this point of view inject does everything I need. But it would be a lot of code to achieve what the new inject could do in a single line. My suggestion would be to add methods like eachTupel or injectTupel instead of changing inject. Cheers Sascha