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

Reply via email to