I use ~and patterns to first match structure and then match syntax classes to 
do what you're doing.
-Ian
----- Original Message -----
From: Stephen Chang <stch...@ccs.neu.edu>
To: Racket Users <users@racket-lang.org>
Sent: Fri, 13 Jun 2014 15:03:44 -0400 (EDT)
Subject: [racket] pass pattern vars as syntax-class args before they appear in 
syntax-parse pattern

I want to do something like this:

#lang racket
(require syntax/parse)

(define-syntax-class (myclass . args)
  (pattern x:id))

(syntax-parse #'(a (b c))
  [((~var x (myclass #'(y ...))) ...
    (y z) ...)
   #'(x ...)])

But this doesnt work because I'm trying to pass y before it is bound.
Is there an elegant way to do this, while still preserving my
syntax-class abstraction? If I leave x undeclared initially and then
use #:declare, then x ... will match everything, which I dont want.

I'm almost certainly missing something obvious but I can't figure it out.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to