Re: [racket] Need help with macro...

2012-02-13 Thread Brian Mastenbrook
On 02/12/2012 12:30 PM, FS Racket wrote: I'm trying to write a macro that where the pre-transformation form is: (==> exp1 exp2 ... expn) and where exp2 through expression expn are sexps that contain a '_' placeholder. The idea is that starting with exp2, the _ gets replaced with the previous e

Re: [racket] Need help with macro...

2012-02-12 Thread Richard Cleis
On Feb 12, 2012, at 2:53 PM, FS Racket wrote: > In the example that doesn't work, the first mult is needed for another use of > ==>. In the simpler examples, it is not. Notice that the orphaned mult occurs > on the second step when another use is expanded, while in the simpler > examples anoth

Re: [racket] Need help with macro...

2012-02-12 Thread FS Racket
> > In the example that doesn't work, the first mult is needed for another use > of ==>. In the simpler examples, it is not. Notice that the orphaned mult > occurs on the second step when another use is expanded, while in the > simpler examples another use of ==> does not occur. In the simple case

Re: [racket] Need help with macro...

2012-02-12 Thread Richard Cleis
On Feb 12, 2012, at 1:09 PM, FS Racket wrote: > > > On Sun, Feb 12, 2012 at 1:34 PM, Richard Cleis wrote: > The DrRacket interactions window replies with 48, not an error, when your > syntax is defined in the definitions window, your function is defined in the > interactions area, and the exa

Re: [racket] Need help with macro...

2012-02-12 Thread Matthias Felleisen
Have you considered using this kind of macro: #lang racket (define-syntax ==> (syntax-rules () [(_ (it) one) one] [(_ (it) one two ...) (let ((it one)) (==> (it) two ...))])) (==> (it) (+ 1 1) (+ it 1) (+ it it)) (define mult *) (==> (it) (* 1 1) (* it 1) (* it it)) On Feb 12,

Re: [racket] Need help with macro...

2012-02-12 Thread FS Racket
On Sun, Feb 12, 2012 at 1:34 PM, Richard Cleis wrote: > The DrRacket interactions window replies with 48, not an error, when your > syntax is defined in the definitions window, your function is defined in > the interactions area, and the example is finally run in the interactions > area. > > How

Re: [racket] Need help with macro...

2012-02-12 Thread Richard Cleis
The DrRacket interactions window replies with 48, not an error, when your syntax is defined in the definitions window, your function is defined in the interactions area, and the example is finally run in the interactions area. How are you making it fail? Also, have you attempted to use the Mac

[racket] Need help with macro...

2012-02-12 Thread FS Racket
I'm trying to write a macro that where the pre-transformation form is: (==> exp1 exp2 ... expn) and where exp2 through expression expn are sexps that contain a '_' placeholder. The idea is that starting with exp2, the _ gets replaced with the previous expression. For example: (==> 12 (+ _ 2) (