summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEli Barzilay <eli@barzilay.org>2013-07-16 01:30:51 -0400
committerEli Barzilay <eli@barzilay.org>2013-07-16 01:30:51 -0400
commitd8989c2ae3d685b15c16491e30ae8d40580ed059 (patch)
tree3d873100303fe153e86bc3dc8ccc947123050047
parente8f8e2331bf57da87949cd130d6c21dfcb4862ca (diff)
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.)
-rw-r--r--racket.html.markdown3
1 files changed, 1 insertions, 2 deletions
diff --git a/racket.html.markdown b/racket.html.markdown
index e528bc74..526d008c 100644
--- a/racket.html.markdown
+++ b/racket.html.markdown
@@ -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)))