diff options
author | Eli Barzilay <eli@barzilay.org> | 2013-07-16 04:17:43 -0400 |
---|---|---|
committer | Eli Barzilay <eli@barzilay.org> | 2013-07-16 04:17:43 -0400 |
commit | d97565efa1c220790716a14e7eb74365c358bf24 (patch) | |
tree | fbd3dea6bd5872db5c508eae602198817e1c85b3 /racket.html.markdown | |
parent | 0063574a4d574e4c5fe85c65159f760be7009da2 (diff) |
Quick bad-macro example.
Diffstat (limited to 'racket.html.markdown')
-rw-r--r-- | racket.html.markdown | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/racket.html.markdown b/racket.html.markdown index eb2bf4c0..e894552c 100644 --- a/racket.html.markdown +++ b/racket.html.markdown @@ -353,7 +353,7 @@ m ; => '#hash((b . 2) (a . 1) (c . 3)) <-- no `d' (for ([i (in-range 5 10)]) (printf "i=~a\n" i)) ; => i=5, i=6, ... -;;; Other Sequences +;;; Iteration Over Other Sequences ;; `for' allows iteration over many other kinds of sequences: ;; lists, vectors, strings, sets, hash tables, etc... @@ -557,6 +557,14 @@ vec ; => #(1 2 3 4) (swap! a b) (printf "tmp = ~a; a = ~a; b = ~a\n" tmp a b) ; tmp is unaffected +;; But the are still code transformations, for example: +(define-syntax-rule (bad-while condition body ...) + (when condition + body ... + (bad-while condition body ...))) +;; this macro is broken: it generates infinite code, if you try to use +;; it, the compiler will get in an infinite loop + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 10. Contracts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |