--hTiIB9CRvBOLTyqY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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.

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--hTiIB9CRvBOLTyqY
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+VSCkMypVHHlsnwQRAgTgAKDI9rQjfJCUFPQag9vpHZQJWHHkKQCglSc9
QABX2DdH+MMTSSVHTXFP0MYlT
-----END PGP SIGNATURE-----

--hTiIB9CRvBOLTyqY--