Re: [racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-16 Thread David Storrs
Sorawee answered your immediate question, but I figured I'd offer a pointer
to Fear of Macros in case you haven't seen it:
https://www.greghendershott.com/fear-of-macros/  It helped me a lot when I
was trying to get my head around macros.  Also, I got a lot of value from
reading through the code of
https://pkgs.racket-lang.org/package/struct-update

On Thu, Sep 16, 2021 at 4:21 PM Dimaugh Silvestris <
dimaughsilvest...@gmail.com> wrote:

> (sorry if I'm asking too many questions about macros lately, I'm learning
> about them but I keep running into scenarios I can't find documentation for)
>
> I'm trying to capture the value of a variable whose identifier I can only
> get with format-id, inside a with-syntax.
> Something like this pseudocode (imagine name-foo contains a list of
> symbols):
> (define-syntax (my-macro stx)
>   (syntax-case stx ()
> ((_ name other-args ...)
>  (with-syntax* ((varname (format-id #'name "~a-foo" #'name))
> (varval (cons (datum->syntax #'varname) (datum->syntax
> #'(other-args ...)
>#'(define name (λ varval (print varval)))
>
>
> Which of course doesn't work. I understand this might have to do with how
> macros work at an earlier phase than runtime, so is it impossible?
>
> --
> 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/CAN4YmRF%3Do3NsXOvK2fvUDeYL_jfA9r946%3D%3DguoGb_%3DKyS%3Dm%2Bxw%40mail.gmail.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/CAE8gKod53kD4ZFyxmatP4qx%2BvSKqrnT-if7PCD4MWxA7Tva3-Q%40mail.gmail.com.


[racket-users] É PEDOFILO ASSASSINO: #PAOLOBARRAI DI CRIMINALISSIMA #TERRABITCOIN! IL MALAVITOSO LEGHISTA #LUCASOSTEGNI, POI INCARCERATO, STAVA SCAPPANDO A PORTO SEGURO (BRASILE), DOVE IL KILLER PAOLO

2021-09-16 Thread 'LORENZO PIACENTINI LAZARD MILAN' via Racket Users
É PEDOFILO ASSASSINO: #PAOLOBARRAI DI CRIMINALISSIMA #TERRABITCOIN! IL 
MALAVITOSO LEGHISTA #LUCASOSTEGNI, POI INCARCERATO, STAVA SCAPPANDO A PORTO 
SEGURO (BRASILE), DOVE IL KILLER PAOLO BARRAI HA RICICLATO PARTE DEI 49 MLN 
€ RUBATI DA LEGA LADRONA!

RAPISCE, INCULA ED UCCIDE TANTI BAMBINI: PAOLO BARRAI (NOTO COME "IL 
PEDOFILO DEL BITCOIN, DI LEGA LADRONA, DI STRAGISTA SILVIO BERLUSCONI 
#SILVIOBERLUSCONI E DI NAZISTA MARINA BERLUSCONI #MARINABERLUSCONI ")! 
SEMPRE A "SPENNARE" ECONOMICAMENTE I POLLI DEL WEB! FALSO, LADRO, 
TRUFFATORE! AZZERA I TUOI RISPARMI! NON AZZECCA MAI PREVISIONI IN BORSA! É 
NAZISTA OMICIDA E RICICLA SOLDI STRA ASSASSINI DI NDRANGHETA, CAMORRA, 
MAFIA, SACRA CORONA UNITA E LEGA LADRONA (OLTRE CHE DI PEDOFILO ASSASSINO 
SILVIO BERLUSCONI)!

SALVE. SONO ANDREAS NIGG. VICE PRESIDENT DI BANCA SAFRA SARASIN DI ZURIGO. 
E VI VOGLIO DIRE CON TUTTE LE MIE FORZE CHE...

IL LEGHISTA PEDOFILO ED ASSASSINO PAOLO BARRAI (NATO A MILANO IL 
28.6.1965), IL LEGHISTA INCULA ED AMMAZZA BAMBINI PAOLO PIETRO BARRAI (NOTO 
IN TUTTO IL MONDO COME IL PEDOFILO DEL BITCOIN) E' DA ANNI INDAGATO DA 
PROCURA DI MILANO, PROCURA DI LUGANO, PROCURA DI ZUGO, SCOTLAND YARD 
LONDRA, FBI NEW YORK, POLICIA CIVIL DI PORTO SEGURO (BR).

É DAVVERO PEDERASTA ED OMICIDA: PAOLO BARRAI DI CRIMINALE TERRA BITCOIN (O 
CRIMINALE TERRABITCOIN CLUB)! IL LEGHISTA DELINQUENTE LUCA SOSTEGNI, 
ARRESTATO, SCAPPAVA IN CITATA PORTO SEGURO (BR), OSSIA, GUARDA CASO, DOVE 
IL KILLER NAZISTA PAOLO BARRAI HA RICICLATO PARTE DEI 49 MLN € RUBATI DA 
LEGA LADRONA!

(ECCONE LE PROVE
https://oneway2day.files.wordpress.com/2019/01/indagatoaiutalelisteciviche.jpg
http://www.rotadosertao.com/noticia/10516-porto-seguro-policia-investiga-blogueiro-italiano-suspeito-de-estelionato
http://noticiasdeportoseguro.blogspot.com/2011/03/quem-e-pietro-paolo-barrai.html
 
)

É TRUFFATORE, PEDOFILO ED ASSASSINO: PAOLO BARRAI( O TRUFFATORE, PEDOFILO 
ED ASSASSINO PAOLO PIETRO BARRAI). DI CRIMINALE TERRA BITCOIN (ASSOCIAZIONE 
CON INTENTO DI FOTTERE, FREGARE, SPENNARE POLLI VIA INTERNET, IL TUTTO VIA 
NAZIFASCISTA SITO TELEGRAM) E CRIMINALISSIMO BLOG MERCATO LIBERO, ALIAS 
"MERDATO" LIBERO! INDAGATO, AL MOMENTO, DALLA PROCURA DI MILANO. COME PURE 
DA PROCURA DI LUGANO, SCOTLAND YARD LONDRA, FBI NEW YORK, POLICIA CIVIL DI 
PORTO SEGURO (BR).

TROVATE TANTI ALTRI VINCENTISSIMI DETTAGLI, A PROPOSITO DI QUESTO, QUI:
https://comp.lang.python.narkive.com/qkxGCaas/e-pedofilo-ed-assassino-paolo-barrai-di-criminale-terra-bitcoin-e-truffatore-spenna-i-polli-del-web-

-- 
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/8d276e03-62fe-465c-b7de-507d846ac3e4n%40googlegroups.com.


Re: [racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-16 Thread Sorawee Porncharoenwase
In general, it would be helpful to provide an example of the macro use, so
that we know what you want to do. If it doesn't work, it would be helpful
to provide the buggy program and an error message so that we can help with
the issue that you are encountering.

>From my guess, you have a variable named abc-foo somewhere, and with this
macro, you wish to define a function named abc that can access the value of
abc-foo? If so, here’s an example of a working program:

#lang racket

(require (for-syntax racket/syntax))

(define-syntax (my-macro stx)
  (syntax-case stx ()
[(_ name other-args ...)
 (with-syntax ([varname (format-id #'name "~a-foo" #'name)])
   #'(define name
   (λ (other-args ...)
 (println (list varname other-args ...)]))

(define abc-foo 123)
(my-macro abc x y)
(abc 5 6) ;=> '(123 5 6)





On Thu, Sep 16, 2021 at 1:21 PM Dimaugh Silvestris <
dimaughsilvest...@gmail.com> wrote:

> (sorry if I'm asking too many questions about macros lately, I'm learning
> about them but I keep running into scenarios I can't find documentation for)
>
> I'm trying to capture the value of a variable whose identifier I can only
> get with format-id, inside a with-syntax.
> Something like this pseudocode (imagine name-foo contains a list of
> symbols):
> (define-syntax (my-macro stx)
>   (syntax-case stx ()
> ((_ name other-args ...)
>  (with-syntax* ((varname (format-id #'name "~a-foo" #'name))
> (varval (cons (datum->syntax #'varname) (datum->syntax
> #'(other-args ...)
>#'(define name (λ varval (print varval)))
>
>
> Which of course doesn't work. I understand this might have to do with how
> macros work at an earlier phase than runtime, so is it impossible?
>
> --
> 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/CAN4YmRF%3Do3NsXOvK2fvUDeYL_jfA9r946%3D%3DguoGb_%3DKyS%3Dm%2Bxw%40mail.gmail.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/CADcueguMfdx5zjRw4iP%3D3_7PhzjpzSMbS02pzVqTPwGMfP7jjQ%40mail.gmail.com.


[racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-16 Thread Dimaugh Silvestris
(sorry if I'm asking too many questions about macros lately, I'm learning
about them but I keep running into scenarios I can't find documentation for)

I'm trying to capture the value of a variable whose identifier I can only
get with format-id, inside a with-syntax.
Something like this pseudocode (imagine name-foo contains a list of
symbols):
(define-syntax (my-macro stx)
  (syntax-case stx ()
((_ name other-args ...)
 (with-syntax* ((varname (format-id #'name "~a-foo" #'name))
(varval (cons (datum->syntax #'varname) (datum->syntax
#'(other-args ...)
   #'(define name (λ varval (print varval)))


Which of course doesn't work. I understand this might have to do with how
macros work at an earlier phase than runtime, so is it impossible?

-- 
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/CAN4YmRF%3Do3NsXOvK2fvUDeYL_jfA9r946%3D%3DguoGb_%3DKyS%3Dm%2Bxw%40mail.gmail.com.