Re: [racket-users] macro guard question (ellipsis)

2019-06-19 Thread Kevin Forchione
> On Jun 18, 2019, at 9:03 PM, Sorawee Porncharoenwase > wrote: > > Also note that with syntax/parse, it becomes much easier: > > (require (for-syntax syntax/parse)) > > (define-syntax (foo stx) > (syntax-parse stx > [(_ (key:id val:id ...) ...) > #'(quote (list ((quote key)

Re: [racket-users] macro guard question (ellipsis)

2019-06-18 Thread Sorawee Porncharoenwase
Also note that with syntax/parse, it becomes much easier: (require (for-syntax syntax/parse)) (define-syntax (foo stx) (syntax-parse stx [(_ (key:id val:id ...) ...) #'(quote (list ((quote key) (quote val) ...) ...))])) On Tue, Jun 18, 2019 at 8:56 PM Sorawee Porncharoenwase <

Re: [racket-users] macro guard question (ellipsis)

2019-06-18 Thread Sorawee Porncharoenwase
I’d write this. Not sure if there’s a better way. (define-syntax (foo stx) (syntax-case stx () [(_ (key val ...) ...) (andmap identifier? (syntax->list #'(key ... {~@ val ...} ...))) #'(quote (list ((quote key) (quote val) ...) ...))])) On Tue, Jun 18, 2019 at 8:11 PM Kevin

[racket-users] macro guard question (ellipsis)

2019-06-18 Thread Kevin Forchione
Hi guys, I’ve been trying to figure out the syntax for a guard when the pattern has ellipsis and you want to guard one of the variables. Here’s an uninteresting macro but it shows what I mean. #lang racket (define-syntax (foo stx) (syntax-case stx () [(_ (key val ...) ...) (and