Re: [racket-users] Splicing the result of one macro into another

2019-08-21 Thread Sorawee Porncharoenwase
> > I appreciate all of the Racket documentation, but I think there is a need >> for a much better presentation of the material in a graduated way. >> > I think what you are saying is, there should be more Racket Guide content, and I think everyone agrees on that... > you seem to have an excellen

Re: [racket-users] Splicing the result of one macro into another

2019-08-20 Thread Brian Adkins
On Tuesday, August 20, 2019 at 9:11:54 PM UTC-4, Brian Adkins wrote: > > On Tuesday, August 20, 2019 at 8:43:07 PM UTC-4, Sorawee Porncharoenwase > wrote: >> >> >>1. You will need a cooperation of phone-numbers macro. There are two >>ways I am aware of >>1.1 You could hard code in pho

Re: [racket-users] Splicing the result of one macro into another

2019-08-20 Thread Brian Adkins
On Tuesday, August 20, 2019 at 8:43:07 PM UTC-4, Sorawee Porncharoenwase wrote: > > >1. You will need a cooperation of phone-numbers macro. There are two >ways I am aware of >1.1 You could hard code in phone-numbers to deal with add-prefix >directly. >1.2 A more general appro

Re: [racket-users] Splicing the result of one macro into another

2019-08-20 Thread Ben Greenman
On 8/20/19, Brian Adkins wrote: > Consider the following two macros: > > (require (for-syntax syntax/parse)) > > (define-syntax (phone-numbers stx) > (syntax-parse stx > [(_ ((~literal number) phone) ...) > #'(list phone ...)])) > > (define x (phone-numbers >(number "1212")

Re: [racket-users] Splicing the result of one macro into another

2019-08-20 Thread Sorawee Porncharoenwase
1. You will need a cooperation of phone-numbers macro. There are two ways I am aware of 1.1 You could hard code in phone-numbers to deal with add-prefix directly. 1.2 A more general approach is to use local-expand in phone-numbers to partially expand macros in the body of phone-nu

[racket-users] Splicing the result of one macro into another

2019-08-20 Thread Brian Adkins
Consider the following two macros: (require (for-syntax syntax/parse)) (define-syntax (phone-numbers stx) (syntax-parse stx [(_ ((~literal number) phone) ...) #'(list phone ...)])) (define x (phone-numbers (number "1212") (number "2121"))) ; ==> '("1212" "2121")