From: "DanDiebolt.exe" Date: 2008-09-12T23:22:35+09:00 Subject: Re: Redefe each to include each_with_index and arity=2 --0-254334667-1221229756=:72529 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for pointing this out. I have two motivations to pursue this:=20 1) I am interested in more deeply learning all of ruby language constructs = but I only occasionally write my own classes & iterators. I would like to g= et the the point where I can do this with ease. 2) As a practical matter I often have to modify code I wrote a while ago th= at was originally thrown together for a quick solution to a one of a kind p= roblem. So I like to use editing techniques that can quickly modify code wi= thout of a lot of rework. It may seem trivial, but is sure seems to me that= adding an index parameter to the each iterator is a lot easier than changi= ng the method to each_with_index AND adding an index parameter. In other wo= rds, moving from this code: a.each do |item| =A0 #process item end to this code: a.each do |item,index| =A0 #process item & index end is easier to remember and edit than using this code: a.each_with_index do |item,index| =A0 #process item & index end So if Ruby is such a great dynamic language and DSL (I know it is!) there s= hould be a straightforward way to accomplish this despite the *args problem= you mention. So does anyone know how each could be expanded in this fashion to work for = all enumerable types (ranges, hashes, sets ...)? --0-254334667-1221229756=:72529--