[plt-scheme] [R6RS] syntax-rules woes

From: Filipe Cabecinhas (filcab at gmail.com)
Date: Tue May 13 19:17:01 EDT 2008

Hi,

I'm writing a macro that can be distilled to the following form:
(define-syntax a
   (syntax-rules (-)
     [(a b ... - c - . d)
      (list b ... c 'd)]))

When I try to use it with an empty 'd, it works:
 > (a 1 2 3 - 42 -)
{1 2 3 42 ()}

But, if I try to put something after the last '-, it says it's bad  
syntax:
 > (a 1 2 3 - 42 - 1 2 3 4)
a: bad syntax in: (a 1 2 3 - 42 - 1 2 3 4)

 From the R6RS standard, I think it should match:
	• P is of the form (P1 ... Pk Pe <ellipsis> Pm+1 ... Pn . Px), where  
<ellipsis> is the identifier ... and F is a list or improper list of n  
elements whose first k elements match P1 through Pk, whose next m - k  
elements each matchPe, whose next n - m elements match Pm+1 through  
Pn, and whose nth and final cdr matches Px.


Is this a bug or am I missing something?

Thanks for the help,

   - Filipe Cabecinhas





Posted on the users mailing list.