Martin DeMello <martindemello / yahoo.com> wrote:
> Simon Strandgaard <neoneye / adslhome.dk> wrote:
> > Simon Strandgaard <neoneye / adslhome.dk> wrote:
> > [snip] 
> > > Your 'of' is a mix between times and map. Wouldn't it be better to
> > > name it 'times_map' ?
> > > 
> > 
> > Even simpler.. it would make sense to me if it were just named 'maps'
> > 
> >   a, b, c = 3.maps {|n| -n}
> >   # a=0, b=-1, c=-2
> 
> Or even just map (there's no Numeric#map) - I don't like that either
> [ruby-talk:62177] but I can't think of anything I like better.

Agree, Numeric.map would be perfect.
 
irb(main):001:0> (2..4).map{|i| -i}
=> [-2, -3, -4]
irb(main):002:0> 5.map{|i| -i}
NoMethodError: undefined method `map' for 5:Fixnum
        from (irb):2
irb(main):003:0> 

-- 
Simon Strandgaard