> 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)
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 <
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
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
4 matches
Mail list logo