[racket] Call by reference macro example in Racket Guide
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 14-12-11 21:19, Harry Spier wrote:
> Dear list members,
>
> In the Racket Guide 16.1.7 Extended Example: Call-by-Reference
> Functions it shows how with macros to set up call by reference
> versions of Racket functions.
>
> I'm a little bit confused on why for the example, the macro (swap
> x y) was used as the example function to turn into a
> call-by-reference function, since doesn't the macro (swap x y)
> already act like a call-by-reference function.
I think the point is to contrast
(define (f x y) (swap x y))
with
(define-cbr (f x y) (swap x y)).
That first f is a function that swaps its local arguments with no
change to the outside world, while the second f is a macro (IIUC) that
mutates its real (for lack of a better term (on my part)) arguments,
through the macro magic of define-cbr.
Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk7ptigACgkQp/VmCx0OL2yZXgCfcssK4HvrAHyr4dKYEIXAXbrG
e3kAoIh30Ojc47p16Jtb5ksxyLixFRBS
=0lMo
-----END PGP SIGNATURE-----