Gotcha! Thanks! And also thanks Alex, you gave me the right answer, I just
didn't understand.
On Monday, July 24, 2017 at 2:28:32 PM UTC-4, Philip McGrath wrote:
> The error message from `id:my-id` seems very confusing. You can't use the
> colon notation with syntax classes that take arguments.
The error message from `id:my-id` seems very confusing. You can't use the
colon notation with syntax classes that take arguments. You have to write
something like:
(define-syntax (my-let stx)
(syntax-parse stx
[(_ ([id binding] ...) body ... last-body)
#:declare id (my-id 'let "an ident
Sorry, I think I need to elaborate a bit more!
I've written code as follows
(define-syntax-class my-id
(pattern id
#:do (if (identifier? #'id) (values)
(raise-user-error (~a "Expected id: " (syntax->datum #'id))
(define-syntax (my-let stx)
(syntax-parse stx
[(_ ([id
> On Jul 24, 2017, at 1:06 PM, Sam Waxman wrote:
>
> Probably a silly question but I can't figure out how to get this working.
>
> I want to have a syntax class that I can pass arguments into. So,
>
> (define-syntax-class (my-syn-class argument)
> ...
> )
>
> (syntax-parse #'some-syntax
> [
Do you mean this:
#lang racket
(require (for-syntax syntax/parse))
(begin-for-syntax
(define-syntax-class sc
))
(define-syntax (ds stx)
(syntax-parse stx
[(_ x:sc) #'0]))
(ds 10) ;; <— 10 is NOT an sc
> On Jul 24, 2017, at 1:06 PM, Sam Waxman wrote:
>
> Probably a silly que
Probably a silly question but I can't figure out how to get this working.
I want to have a syntax class that I can pass arguments into. So,
(define-syntax-class (my-syn-class argument)
...
)
(syntax-parse #'some-syntax
[(_ x:**)])
In place of ** what do I write to pass the argument
6 matches
Mail list logo