Re: [racket-users] Macro generating macro question

2023-05-24 Thread Kevin Forchione


> On May 24, 2023, at 2:11 AM, Jens Axel Søgaard  wrote:
> 
> #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)

Thanks! That was the fundamental concept I was missing. I don’t recall seeing 
that in the documentation, but now that I know I’ll search for that and see if 
I glossed over it somehow. 

-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/D299A992-F57A-4050-B8DD-67DCAC468124%40gmail.com.


Re: [racket-users] Macro generating macro question

2023-05-24 Thread Jens Axel Søgaard
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 :

> 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.


Re: [racket-users] Macro generating macro question

2023-05-24 Thread Stephen De Gabrielle
Hi Kevin

The most active places for ‘Racketeers’ is the Racket [Discourse](
https://racket.discourse.group/) and [Discord](https://discord.gg/6Zq8sH5)


Please join us!


See also https://github.com/racket/racket/wiki/Macros - in particular i
think you may find what you are looking for in
https://docs.racket-lang.org/syntax-parse-example/index.html


(many who prefer email just use discourse in ‘mailing list mode’)


Best regards

Stephen

On Wed, 24 May 2023 at 05:27, Kevin Forchione  wrote:

> 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
> .
>
-- 


-- 
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/CAGHj7-Jda1tiv4xQu-4CCV212LMPQ3bPwRV0uzMqu4B%2Bk99R%2Bw%40mail.gmail.com.


[racket-users] Macro generating macro question

2023-05-23 Thread Kevin Forchione
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.