[racket] define-syntax-rule/id
10 minutes ago, Laurent wrote:
> On Tue, Apr 19, 2011 at 10:52, Eli Barzilay <eli at barzilay.org> wrote:
>
> > Yesterday, Jon Rafkind wrote:
> > >
> > > This is mostly straight-forward except that to get the right lexical
> > > scope for `get-x1' we need to do a little hack (by assuming the
> > > argument list has at least one thing in it). Of course the original
> > > macro could enforce such a property as well.
> >
> > Why not use `stx' directly?
> >
> Could you elaborate? `stx' in the docs does not look relevant.
I meant in the argument to `datum->syntax'...
7 minutes ago, Sam Tobin-Hochstadt wrote:
> On Mon, Apr 18, 2011 at 2:42 PM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
> > (with-syntax ([id (datum->syntax (car (syntax->list #'(arg ...)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
here
> > (string->symbol
> > (let ([arg (syntax-e #'arg)] ...)
> > id-rename))
> > (car (syntax->list #'(arg ...))))])
>
> This can all be replaced by:
>
> (with-syntax ([id (format-id stx (let ([arg (syntax-e #'arg)] ..) id-rename))])
> (begin body ...))
which Sam used in this code.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!