summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Bard <github@adambard.com>2013-07-29 00:05:16 -0700
committerAdam Bard <github@adambard.com>2013-07-29 00:05:16 -0700
commit8f058a229a8f86afce012f2cce7a278195a945ae (patch)
tree4e5afd207c8573ba59ffa119403863229a00f180
parenta7fe2983ccbe5de97d5f21ee1ee0e2aac1e0be16 (diff)
parent3c3fb648203286da63f5b5c60c380568ec9b17f5 (diff)
Merge pull request #142 from gustavoschmidt/master
Fix hygienic macro example in racket.html.markdown
-rw-r--r--racket.html.markdown15
1 files changed, 10 insertions, 5 deletions
diff --git a/racket.html.markdown b/racket.html.markdown
index b6c1f86b..adacd91d 100644
--- a/racket.html.markdown
+++ b/racket.html.markdown
@@ -5,6 +5,7 @@ filename: learnracket.rkt
contributors:
- ["th3rac25", "https://github.com/voila"]
- ["Eli Barzilay", "https://github.com/elibarzilay"]
+ - ["Gustavo Schmidt", "https://github.com/gustavoschmidt"]
---
Racket is a general purpose, multi-paradigm programming language in the Lisp/Scheme family.
@@ -555,11 +556,15 @@ vec ; => #(1 2 3 4)
(set! x y)
(set! y tmp)))
-(define tmp 1)
-(define a 2)
-(define b 3)
-(swap! a b)
-(printf "tmp = ~a; a = ~a; b = ~a\n" tmp a b) ; tmp is unaffected
+(define tmp 2)
+(define other 3)
+(swap! tmp other)
+(printf "tmp = ~a; other = ~a\n" tmp other)
+;; The variable `tmp` is renamed to `tmp_1`
+;; in order to avoid name conflict
+;; (let ([tmp_1 tmp])
+;; (set! tmp other)
+;; (set! other tmp_1))
;; But they are still code transformations, for example:
(define-syntax-rule (bad-while condition body ...)