From: "Peña, Botp" Date: 2005-07-11T10:50:31+09:00 Subject: Re: accessing index inside map Yukihiro Matsumoto [mailto:matz@ruby-lang.org] wrote: #We have vague plan to make enumerating method to return Enumerator #when no block is given in the future, so that # # require 'enumerator' # (1..6).enum_for(:each_with_index).map{|x,i|[2,5].include?(i) #? x : x*2} # #would be # # (1..6).each_with_index.map{|x,i|[2,5].include?(i) ? x : x*2} # #then. It's much simpler isn't it? Hi sir Matz, You're vague plan produces clearer ruby.. but isn't each_with_index.map so close to being map_with_index ? (1..6).map_with_index{|x,i|[2,5].include?(i) ? x : x*2} is very easy to my tiny brain since all i have to remember is map (just like (in array) all i have to focus is each, then i follow thru with each_with_index) i'm sorry, i'm a map/collect fan so pardon my insistence :-) thanks in advance. kind regards -botp -another spoiled nuby spoiled by map # # matz. #