--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.ne=
t wrote:
> >   pr =3D Proc.new { puts "hi from anonymous Proc" }
> >   methproc =3D A.new.method(:talk).to_proc
> >=20
> >   [1,2,3].each &pr         # "hi from anonymous Proc\n" * 3
> >   [1,2,3].each &methproc   # in `talk': wrong # of arguments(1 for 0)
>=20
> Interesting. I would have just done
>=20
>   [1,2,3].each { methproc.call }
>=20
> and never have noticed. Can you explain what is happening when
> I replace {...} with &pr.

& turns a proc into a block.

--=20
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+MMTSSVHTXFP0MY=
=iPlT
-----END PGP SIGNATURE-----

--hTiIB9CRvBOLTyqY--

Jim Freeze (jim / freeze.org) wrote:

> On Friday, 21 February 2003 at  1:19:17 +0900, dblack / candle.superlink.ne=
t wrote:
> >   pr =3D Proc.new { puts "hi from anonymous Proc" }
> >   methproc =3D A.new.method(:talk).to_proc
> >=20
> >   [1,2,3].each &pr         # "hi from anonymous Proc\n" * 3
> >   [1,2,3].each &methproc   # in `talk': wrong # of arguments(1 for 0)
>=20
> Interesting. I would have just done
>=20
>   [1,2,3].each { methproc.call }
>=20
> and never have noticed. Can you explain what is happening when
> I replace {...} with &pr.

& turns a proc into a block.

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

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

iD8DBQE+VSCkMypVHHlsnwQRAgTgAKDI9rQjfJCUFPQag9vpHZQJWHHkKQCglSc9
QABX2DdH+MMTSSVHTXFP0MY=
=iPlT
-----END PGP SIGNATURE-----