[plt-scheme] define-syntax question

From: Michael Vanier (mvanier at cs.caltech.edu)
Date: Thu Jun 26 22:29:12 EDT 2003

I'm trying to come up with a scheme equivalent for a restricted version of
common lisp's "label" construct, but I'm getting an error I don't
understand.  Here is my code:

  (define-syntax label
    (syntax-rules ()
      (((_ f (lambda (p1 p2 ...) e)) a1 a2 ...)
       (letrec ((f (lambda (p1 p2 ...) e)))
         (f a1 a2 ...)))))

When I type this into DrScheme, I get:

  syntax: no pattern variables before ellipses in template in: (p1 p2 ...)

referring to the second occurrence of this pattern.  I gather that ellipses
can only be used in certain places in these constructs, but I'm at a loss
how to fix this.  Can any syntax-rules/case experts tell me how to fix



Posted on the users mailing list.