[plt-scheme] Re: misplaced ellipses

From: David Van Horn (dvanhorn at cs.brandeis.edu)
Date: Tue Feb 26 15:41:35 EST 2008

Matthew Flatt wrote:
> At Tue, 26 Feb 2008 13:48:45 -0500, David Van Horn wrote:
>> (define-syntax f
>>    (syntax-rules ()
>>      [(f id)
>>       (syntax (... id))]))
>>
>> (f ...)
>> ;; expect (syntax (... ...)),
>> ;; ie., the identifier `...'.
>>
>>
>> I get instead:
>>
>> syntax: misplaced ellipses in template in: ...
>>
>> Why is this the case?
> 
> The macro `(f ...)' expands to `(syntax ...)', which is indeed a syntax
> error.

If the syntax-rule is

   (f id) =transcribe=> (syntax (... id))

I would expect (f ...) =transcribe> (syntax (... ...)), which is not a 
syntax error.

> I think you meant
> 
> (define-syntax f
>    (syntax-rules ()
>      [(f id)
>       (... id)]))     ; no `syntax'

No, I want a macro that takes an identifier, expands into an expression 
that when evaluated, produces the syntax object representing the 
identifier (even when this identifier is the ... one).

So for example (identifier? (f x)) is true.

David



Posted on the users mailing list.