gabriele renzi <surrender_it / rc1.vip.ukl.yahoo.com> wrote:
> il Wed, 26 May 2004 06:29:51 GMT, Martin DeMello
> <martindemello / yahoo.com> ha scritto::
> 
> >> 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.
> 
> I believe it is Integer#map more than Numeric. What whould you expect
> from (3/Complex(1,i)).map {|x| -x} ? :)
> 

It depends on 2 things:

A)  what the default element are

B)  what the Range  default_element..specified_element yields


Maybe it would be a good idea to extend all Numeric classes
with a null_element.   ala traits

p 9.null_element  # -> 0
p Complex(123, 456).null_element  # -> 42

when one does  "x.map{|y| y.z}"  then  map makes a range between
the null_element and x.   

-- 
Simon Strandgaard