Improve macro definition.

It's more robust to use `let' to have the macro result in its own new
scope.  (Unrelated to the hygiene point, of course.)
This commit is contained in:
Eli Barzilay 2013-07-16 01:30:51 -04:00
parent e8f8e2331b
commit d8989c2ae3

View File

@ -423,8 +423,7 @@ vec ; => #(1 2 3 4)
;; Macros are hygienic, you cannot clobber existing variables!
(define-syntax-rule (swap x y)
(begin
(define tmp x)
(let ([tmp x])
(set! x y)
(set! y tmp)))