From 229ed0c70dcd5ad237e452cb339d7bce3f6d4228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Mon, 3 Oct 2016 23:14:23 +0200 Subject: [PATCH 1/2] In the documentation for define-macro, use syntax-object instead of (syntax result-expr), as that's the way it is documented below --- beautiful-racket-lib/br/scribblings/br.scrbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beautiful-racket-lib/br/scribblings/br.scrbl b/beautiful-racket-lib/br/scribblings/br.scrbl index 6e424e4..aa2da45 100644 --- a/beautiful-racket-lib/br/scribblings/br.scrbl +++ b/beautiful-racket-lib/br/scribblings/br.scrbl @@ -205,7 +205,7 @@ Define a function that behaves differently depending on how many arguments are s (define-macro id (syntax other-id)) (define-macro id (lambda (arg-id) result-expr ...+)) (define-macro id transformer-id) -(define-macro id (syntax result-expr)) +(define-macro id syntax-object) (define-macro (id pat-arg ...) expr ...+) ]] Create a macro using one of the subforms above, which are explained below: From c6c1e70cab04d01197a4721bc81b2ca1efaabd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Mon, 3 Oct 2016 23:14:52 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Removed=20spurious=20space=20in=20@seclink[?= =?UTF-8?q?=E2=80=A6]=20=20{text}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beautiful-racket-lib/br/scribblings/br.scrbl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/beautiful-racket-lib/br/scribblings/br.scrbl b/beautiful-racket-lib/br/scribblings/br.scrbl index aa2da45..bf734e3 100644 --- a/beautiful-racket-lib/br/scribblings/br.scrbl +++ b/beautiful-racket-lib/br/scribblings/br.scrbl @@ -274,8 +274,7 @@ bad-listener @specsubform[#:literals (define-macro) (define-macro (id pat-arg ...) result-expr ...+)]{ -If the first argument is a @seclink["stx-patterns" #:doc '(lib "scribblings/reference/reference.scrbl")] -{syntax pattern} starting with @racket[id], then create a syntax transformer for this pattern using @racket[result-expr ...] as the return value. As usual, @racket[result-expr ...] needs to return a @seclink["stx-obj" #:doc '(lib "scribblings/guide/guide.scrbl")]{syntax object} or you'll get an error. +If the first argument is a @seclink["stx-patterns" #:doc '(lib "scribblings/reference/reference.scrbl")]{syntax pattern} starting with @racket[id], then create a syntax transformer for this pattern using @racket[result-expr ...] as the return value. As usual, @racket[result-expr ...] needs to return a @seclink["stx-obj" #:doc '(lib "scribblings/guide/guide.scrbl")]{syntax object} or you'll get an error. The syntax-pattern notation is the same as @racket[syntax-case], with one key difference. If a @racket[pat-arg] has a @tt{CAPITALIZED-NAME}, it's treated as a named wildcard (meaning, it will match any expression in that position, and can be subsequently referred to by that name). Otherwise, @racket[pat-arg] is treated as a literal (meaning, it will only match the same expression).