Hi Kevin,

When you are writing macro generating macros there are two levels of
ellipsis.
The outer one, which you can write as ... as normal and the inner one which
you need to escape.
You can escape it with (... ...). That looks odd to me, so I usually bind
it to an identifier named ooo.

#lang racket
(require (for-syntax syntax/parse
                     racket/syntax))

(define-syntax (make-id-macro stx)
  (syntax-parse stx
    [(_ id)
     (with-syntax ([name (format-id #'id "do-~a" #'id)]
                   [ooo  #'(... ...)])
       #'(define-syntax (name stx)
           (syntax-parse stx
             [(_ parms ooo)
              #'(list parms ooo)])))]))

(make-id-macro foo)
(do-foo 1 2)


See you on Racket Discourse.
/Jens Axel


Den ons. 24. maj 2023 kl. 06.27 skrev Kevin Forchione <lyss...@gmail.com>:

> Hi guys,
> I’m stumped.  In a nutshell I want to write a macro that is passed  an id
> and will produce a macro called id that can take variable arguments. I’m
> sure I’m overlooking something fundamental. The basic form below “works” if
> I don’t have ellipsis aver the variables, but that’s not what I’m after.
> Here’s an example that is obviously wrong, but is along the lines of what
> I’m looking for:
>
> #lang racket
>
>
> (require (for-syntax syntax/parse
>                      racket/syntax))
>
> (define-syntax (make-id-macro stx)
>   (syntax-parse stx
>     [(_ id)
>      (with-syntax ([name (format-id #'id "do-~a" #'id)])
>        #'(define-syntax (name stx)
>            (syntax-parse stx
>              [(_ parms ...)
>               #'( list parms ...)])))]))
>
> Any help in this and explaining why it fails would be greatly appreciated.
>
> -Kevin
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/beaa2ef6-afd2-4686-829a-390eb69f5620n%40googlegroups.com
> .
>
> Beyond the Racket Users Google Group, Racket Discussions take place on
> Discourse ( https://racket.discourse.group/ ) and Discord (
> https://discord.gg/6Zq8sH5 ). Discussion (but less active) also takes
> place on the Racket Slack https://racket.slack.com/ ( sign up at
> https://racket-slack.herokuapp.com/ ), and IRC #racket
> https://kiwiirc.com/nextclient/irc.libera.chat/#racket
> ---
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/6BC84910-3AC4-4729-8BAA-D1488E84A54B%40gmail.com
> .
>


-- 
-- 
Jens Axel Søgaard

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/beaa2ef6-afd2-4686-829a-390eb69f5620n%40googlegroups.com.

Beyond the Racket Users Google Group, Racket Discussions take place on 
Discourse ( https://racket.discourse.group/ ) and Discord ( 
https://discord.gg/6Zq8sH5 ). Discussion (but less active) also takes place on 
the Racket Slack https://racket.slack.com/ ( sign up at 
https://racket-slack.herokuapp.com/ ), and IRC #racket 
https://kiwiirc.com/nextclient/irc.libera.chat/#racket
--- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgxroAUQhxD6sGaAbL%2B_2WwLAzMdRa_8o_%3DBFx%3DByXS9yw%40mail.gmail.com.

Reply via email to