From: ahoward Date: 2002-11-26T12:45:12+09:00 Subject: Re: each_with_index & collect_with_index? On Tue, 26 Nov 2002, Tim Bates wrote: [snip] T> Array.collect_index{ |i| ... } [snip] a = [42, 'forty-two'] (0...a.size).collect { |idx| idx} >> [0, 1] not too bad... [snip] T> Array.collect_with_index{ |i, el| ... } [snip] a = [42, 'forty-two'] (0...a.size).collect { |i| [i,a[i]] } >> [[0, 42], [1, "forty-two"]] i can see your point. ;-) -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================