mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-04-27 07:33:57 +00:00
Fix hygienic macro example in racket.html.markdown
This commit is contained in:
parent
a7fe2983cc
commit
3c3fb64820
@ -5,6 +5,7 @@ filename: learnracket.rkt
|
|||||||
contributors:
|
contributors:
|
||||||
- ["th3rac25", "https://github.com/voila"]
|
- ["th3rac25", "https://github.com/voila"]
|
||||||
- ["Eli Barzilay", "https://github.com/elibarzilay"]
|
- ["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.
|
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! x y)
|
||||||
(set! y tmp)))
|
(set! y tmp)))
|
||||||
|
|
||||||
(define tmp 1)
|
(define tmp 2)
|
||||||
(define a 2)
|
(define other 3)
|
||||||
(define b 3)
|
(swap! tmp other)
|
||||||
(swap! a b)
|
(printf "tmp = ~a; other = ~a\n" tmp other)
|
||||||
(printf "tmp = ~a; a = ~a; b = ~a\n" tmp a b) ; tmp is unaffected
|
;; 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:
|
;; But they are still code transformations, for example:
|
||||||
(define-syntax-rule (bad-while condition body ...)
|
(define-syntax-rule (bad-while condition body ...)
|
||||||
|
Loading…
Reference in New Issue
Block a user