nobuyoshi nakada [mailto:nobuyoshi.nakada / ge.com] wrote:

#> i'd like to double the element values except those loc on 
#the 2nd and 5th
#> indices eg.
#
#$ ruby -renumerator -e 'p 
#(1..6).enum_for(:each_with_index).map{|x,i|[2,5].include?(i) ? 
#x : x*2}'
#[2, 4, 3, 8, 10, 6]

Hi Nobu,

Wow, cool. But my brain is very tiny compared to other rubyist brains.

i was hoping for something straight like,

>[1,2,3,4,5,6].map{|x,i|[2,5].include?(i) ? x : x*2}
=>[2, 4, 3, 8, 10, 6]

Maybe you can hack one for dumb rubyists like me.

thanks and kind regards -botp

#
#-- 
#Nobu Nakada
#