[racket] Introduction to syntax-parse

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Tue Sep 24 12:20:51 EDT 2013

You need (require (for-syntax syntax/parse)) because you are using it
inside a define-syntax.
On Sep 24, 2013 11:56 AM, "Konrad Hinsen" <konrad.hinsen at fastmail.net>
wrote:

> Hi everyone,
>
> I am trying to learn about syntax-parse, starting with the introduction
> of the "Syntax" documentation.
>
> Unfortunately, the very first example given for the use of syntax-parse
> doesn't work in my Racket installation:
>
>    Welcome to Racket v5.90.0.9.
>    racket@> (require syntax/parse)
>    racket@> (define-syntax (mylet stx)
>                 (syntax-parse stx
>                   [(_ ([var-id rhs-expr] ...) body ...+)
>                    #'((lambda (var-id ...) body ...) rhs-expr ...)]))
>    stdin::277: _: wildcard not allowed as an expression
>      in: (_ ((var-id rhs-expr) ...) body ...+)
>      errortrace...:
>      context...:
>       try-next
>
> /Users/hinsen/Development/racket/pkgs/errortrace-pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:480:4
>
> /Users/hinsen/Applications/Racket/collects/racket/private/misc.rkt:87:7
>
> I tried replacing the wildcard by "mylet", but that only leads to another
> error
> message:
>
>    racket@> (define-syntax (mylet stx)
>                 (syntax-parse stx
>                   [(mylet ([var-id rhs-expr] ...) body ...+)
>                    #'((lambda (var-id ...) body ...) rhs-expr ...)]))
>    stdin::842: ...: ellipses not allowed as an expression
>      in: ...
>      errortrace...:
>      context...:
>       try-next
>
> /Users/hinsen/Development/racket/pkgs/errortrace-pkgs/errortrace-lib/errortrace/errortrace-lib.rkt:480:4
>
> /Users/hinsen/Applications/Racket/collects/racket/private/misc.rkt:87:7
>
> Am I doing something wrong here? Or are the examples obsolete?
>
> Konrad.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130924/9b33f2eb/attachment.html>

Posted on the users mailing list.