Here's one more solution, using "template metafunctions" (inspired by Redex's metafunctions). And yes, most of the point of template metafunctions is to have something that cooperates with ellipses like you want.

> (require syntax/parse
           syntax/parse/experimental/template
           racket/syntax)
> (define-template-metafunction join
    (syntax-parser
     [(_ a:id b:id)
      (format-id #'a "~a-~a" #'a #'b)]))
> (syntax-parse #'(foo a b c)
   [(f:id s:id ...)
    (template (list (join f s) ...))])
#<syntax::247 (list foo-a foo-b foo-c)>

Ryan


On 9/2/15 7:00 AM, Konrad Hinsen wrote:
Hi everyone,

I am working on what I consider a simple macro, but after reading all
of the macro-related documentation twice, I still don't see how to do
this.

I want to transform

   (foo a b c)

to

   (list foo-a foo-b foo-c)

Here is my best attempt (using syntax/parse):

(syntax-parse #'(foo a b c)
   [(f:id s:id ...)
    (list (format-id #'f "foo-~a" #'s) ...)])

This yields the error message

   syntax: missing ellipsis with pattern variable in template

In fact, what I want is do something like map over the ellipsis pattern,
but I haven't seen any example for doing this.

Help, please!

Thanks in advance,
   Konrad.


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to