* "Pea, Botp" <botp / delmonte-phil.com> [2005-07-11 20:12:26 +0900]:

> How about 
> 
> [1,2,3,4,5,6].map(WITH_INDEX) {|x,i|[2,5].include?(i) ? x : x*2}
> or
> [1,2,3,4,5,6].map(with_index=>true) {|x,i|[2,5].include?(i) ? x : x*2}

How about a more 'rails' like implementation:

  [1,2,3].map(:with_index) { |x,ix| ... }
  [1,2,3].collect(:with_index) { |x,ix| ... }
  [1,2,3].collect!(:with_index) { |x,ix| ... }
  [1,2,3].each(:with_index) { |x,ix| ... }
  [1,2,3].each { |x| ... }

-- 
Jim Freeze