On Friday, 21 February 2003 at  3:38:30 +0900, Eric Hodel wrote:
> Jim Freeze (jim / freeze.org) wrote:
> 
> > On Friday, 21 February 2003 at  1:19:17 +0900, dblack / candle.superlink.net wrote:
> > >   pr = Proc.new { puts "hi from anonymous Proc" }
> > >   methproc = A.new.method(:talk).to_proc
> > > 
> > >   [1,2,3].each &pr         # "hi from anonymous Proc\n" * 3
> > >   [1,2,3].each &methproc   # in `talk': wrong # of arguments(1 for 0)
> > 
> > Interesting. I would have just done
> > 
> >   [1,2,3].each { methproc.call }
> > 
> > and never have noticed. Can you explain what is happening when
> > I replace {...} with &pr.
> 
> & turns a proc into a block.

So why the error wrong # of arguments?


-- 
Jim Freeze
----------
Always borrow money from a pessimist; he doesn't expect to be paid
back.