Thanks so much! Using (with-syntax ([expanded-b (datum->syntax #'b (local-expand #'b 'expression #f))])
worked out great! On Thursday, July 9, 2020 at 9:44:08 PM UTC-4, William J. Bowman wrote: > > You might want `local-expand`. It can still give you something that is > expanded > further than you want, unless you know exactly which identifier you want > to stop > at, which you can specify in the stop list. > > https://docs.racket-lang.org/reference/stxtrans.html#%28def._%28%28quote._~23~25kernel%29._local-expand%29%29 > > > -- > William J. Bowman > > On Thu, Jul 09, 2020 at 06:30:38PM -0700, Thomas Del Vecchio wrote: > > I'm trying to work through expanding a macro to pass the result into > > another macro. I've attached and pasted the spec below that is my toy > > example. I've tried using expand, but it gives me "(C (#%app (#%top . B) > > (quote 1) (quote 2)))" instead of "(C (in 1 2))". I've also tried many > > other things, but none seem to do what I expect/want. Any help? > > > > #lang racket > > (require (for-syntax syntax/parse)) > > > > ; I want A to take a (B x y) expand it to be passed to C. > > ; (A (B 1 2)) > > ; -> (C (in 1 2)) > > (define-syntax (A stx) > > (syntax-case stx (A) > > [(A b) > > (with-syntax ([expanded-b #'b]) ; <- what goes here? > > #'(C expanded-b))])) > > > > (define-syntax (B stx) > > (syntax-case stx (B) > > [(B x y) > > #'(in x y)])) > > > > (define-syntax (C stx) > > (syntax-case stx (C in) > > [(C (in x y)) > > #'(printf "~a ~a ~n" x y)])) > > > > (A (B 1 2)) ; expect to print "1 2 ~n" > > > > Thanks! > > > > -- > > 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 [email protected] <javascript:>. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/dd6d4e30-9fd9-4e29-9d36-3a4b0935fc4ao%40googlegroups.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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/ddf07f17-8e0a-4b36-a1ee-90d3ee00464eo%40googlegroups.com.

