From: Ross Bamford Date: 2006-01-04T08:03:57+09:00 Subject: Re: Implicit block parameter? On Tue, 03 Jan 2006 22:01:02 -0000, Andrew McGuinness wrote: > Jacob Fugal wrote: >> On 1/3/06, Andrew McGuinness wrote: >> >>> Another way of dealing with it would be if it were easier to get from a >>> method to a Proc object, so instead of, say >>> >>> heads = queues.map { |x| x.first } >>> >>> You could have something more like: >>> >>> heads = queues.map( &:first ) >> Take a look at this: >> http://blogs.pragprog.com/cgi-bin/pragdave.cgi/Tech/Ruby/ToProc.rdoc >> > That's good - if I'm mad, at least I'm not alone. > > And I didn't realise that thing.each( &method(:stuff) ) works already > (the same as thing.each( &method(:stuff).to_proc ) ) :D Yeah, AUIU '&' works a bit like splat but for procs (with to_proc). For a silly example: class String def to_proc lambda { eval self } end end [1,2,3].each &"puts it" gives: 1 2 3 => [1, 2, 3] -- Ross Bamford - rosco@roscopeco.remove.co.uk