Consider this:

$ irb
irb(main):001:0> def doubler(x); x * 2 end
=> nil
irb(main):002:0> (1..3).map &method(:doubler)
=> [2, 4, 6]
irb(main):003:0>

Cheers,
Kent.

On May 23, 2004, at 10:33 PM, Ryan Paul wrote:

> just some syntactic nitpicking:
>
> If I want to perform a map operation using a function...
>
> def somefunc(x)
>   # ... perform some operation on x ...
>   # ... and return a value ...
> end
>
>  I have to do this:
>
> l = [1,2,3].map { |x| somefunc x }
>
>  Why shouldnt I be able to do this:
>
> l = [1,2,3].map somefunc
>
> --SegPhault
>