Re: [racket-users] Positional arguments in syntax classes

2017-07-24 Thread Sam Waxman
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.

Re: [racket-users] Positional arguments in syntax classes

2017-07-24 Thread Philip McGrath
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

Re: [racket-users] Positional arguments in syntax classes

2017-07-24 Thread Sam Waxman
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

Re: [racket-users] Positional arguments in syntax classes

2017-07-24 Thread Alex Knauth
> 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 > [

Re: [racket-users] Positional arguments in syntax classes

2017-07-24 Thread Matthias Felleisen
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

[racket-users] Positional arguments in syntax classes

2017-07-24 Thread Sam Waxman
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