From: nobu.nokada@... Date: 2005-07-13T01:46:17+09:00 Subject: Re: accessing index inside map Hi, At Wed, 13 Jul 2005 01:10:19 +0900, Brian Candler wrote in [ruby-talk:147876]: > However, perhaps 'to_enum' could be called something friendlier, e.g. > > obj.using(:each_with_index).inject(0) {|sum,(a,i)| sum + a*i} `using' sounds too general. > In fact, even > > obj.enum(:each_with_index).inject(0) {|sum,(a,i)| sum + a*i} > > reads better to me, as it's not stressing the creation of an intermediate > object. to_foo looks like you are converting obj into something completely > different, rather than just adding a temporary wrapper. Enumerable#to_enum has an alias named as #enum_for. -- Nobu Nakada