Re: [racket-users] Macro that does substitution

2015-08-03 Thread Matthias Felleisen
Correct. There should never be an exception because the value never ends up in a strict position. -- Matthias On Aug 3, 2015, at 12:44 PM, Andrew Gwozdziewycz wrote: > On Wed, Jul 29, 2015 at 9:30 AM, Matthias Felleisen > wrote: > > On Jul 29, 2015, at 7:50 AM, Klaus Ostermann wrote: >

Re: [racket-users] Macro that does substitution

2015-08-03 Thread Andrew Gwozdziewycz
On Wed, Jul 29, 2015 at 9:30 AM, Matthias Felleisen wrote: > > On Jul 29, 2015, at 7:50 AM, Klaus Ostermann wrote: > > > Thanks, Matthew and Matthias. The service on this mailing list is > incredible! > > > > I know it is not cbn because it is local, but a better name didn't come > to my mind and

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Matthias Felleisen
On Jul 29, 2015, at 7:50 AM, Klaus Ostermann wrote: > Thanks, Matthew and Matthias. The service on this mailing list is incredible! > > I know it is not cbn because it is local, but a better name didn't come to my > mind and it is what I need to solve my problem. It's not about locality, the

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Jens Axel Søgaard
Something like this: #lang racket (require (for-syntax syntax/parse racket/syntax)) (define-syntax (let-cbn stx) (syntax-parse stx [(_let-cbn ([x:id e:expr] ...) body) ;; For each identifier x we need a new identifier bound to (λ () e) (define/with-syntax (x* ...) (generate-tempor

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Klaus Ostermann
Thanks, Matthew and Matthias. The service on this mailing list is incredible! I know it is not cbn because it is local, but a better name didn't come to my mind and it is what I need to solve my problem. Klaus -- You received this message because you are subscribed to the Google Groups "Racke

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Matthias Felleisen
(I was 2/3 there when I noticed Matthew's response.) Klaus, fwiw this is NOT cbn. A cbn let will run the thunks only when they show up in strict positions. Not every identifier shows up in strict positions. On Jul 29, 2015, at 7:37 AM, Matthew Flatt wrote: > At Wed, 29 Jul 2015 06:28:48 -070

Re: [racket-users] Macro that does substitution

2015-07-29 Thread Matthew Flatt
At Wed, 29 Jul 2015 06:28:48 -0700 (PDT), Klaus Ostermann wrote: > I'd like to have a macro "let-cbn" which does this: > > (let-cbn ((x1 e1) ...) body) > > is transformed to > > (let ((x1 (thunk e1)) ...) newbody) > > where newbody is the result of replacing every occurence of x1... by (x1)...

[racket-users] Macro that does substitution

2015-07-29 Thread Klaus Ostermann
I'd like to have a macro "let-cbn" which does this: (let-cbn ((x1 e1) ...) body) is transformed to (let ((x1 (thunk e1)) ...) newbody) where newbody is the result of replacing every occurence of x1... by (x1)... . What is the best way to do that in Racket? -- You received this message becaus