From: Sebastian Hungerecker Date: 2008-02-24T23:03:35+09:00 Subject: Re: passing method references in python & ruby Gregory Marton wrote: > What bugs me about ruby is that I can't do this > def add_one(n) >   n + 1 > end > [3,6,8].map(add_one) >  => [4,7,9] [3,6,8].map(&method(:add_one)) #=> [4, 7, 9] And yeah, it'd be nice if there was a more concise syntax than that, but that's what we've currently got. Thinking about it, you could do something like this if you want a shorter syntax: class Symbol def -@() method(self) end end [3,6,8].map(&-:add_one) But that's kinda hackish. HTH, Sebastian -- Jabber: sepp2k@jabber.org ICQ: 205544826