[racket] Accessing lambda arguments in a macro

From: Daniel MacDougall (dmacdougall at gmail.com)
Date: Fri Sep 16 15:46:39 EDT 2011

Is there any way to define a macro that expands out to a lambda, and then
access the arguments passed to that lambda from outside the macro in the
calling context?
Here's an example of what I mean:

#lang racket

(define-syntax-rule (foo form ...)
  ((lambda (bar) form ...) "ARG"))

(foo "Hello") ; => returns "Hello"

(foo bar)     ; => expand: unbound identifier in module in: bar


I'd like access to the "bar" argument on the last line. Is this possible
with Racket macros?

Thanks,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110916/1459d7bf/attachment.html>

Posted on the users mailing list.