Yes. Yes, that exactly solves my problem. *sheepish look* Thanks. On Tue, Aug 9, 2016 at 8:47 PM, Matthew Butterick <[email protected]> wrote:
> > On Aug 9, 2016, at 7:52 PM, David Storrs <[email protected]> wrote: > > > This solves the problem of creating top-level bindings at run time (more > or less run time, anyway), but it doesn't handle the lexical closure part. > Is there a way to do that? > > The code generated by a macro automatically adopts the lexical context at > the macro-definition site. So is this not analogous to your Perl code? > > ;;;;;;; > > #lang racket > > (define z 1) > > (define-syntax-rule (makefuns name ...) > (begin > (define (name) > (displayln (format "~a: ~a" 'name z)) > (set! z (+ z 1))) ...)) > > (makefuns foo bar baz) > > (foo) ; prints "foo: 1" > (bar) ; prints "bar: 2" > (baz) ; prints "baz: 3" -- 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]. For more options, visit https://groups.google.com/d/optout.

