Matthias Radestock wrote:
Scott may know a way of fixing your problem. However, it occurred to
me that what you'd really want is to redefine DEFINE so that you can
get hold of the *original* (pre macro expansion) body.
Yes! That's exactly what I want.
I don't think I understand how to use this snippet:
(let-syntax ([old-define (syntax-rules ()
[(_ . rest) (define . rest)])])
(define-syntax define
(syntax-rules (lambda)
[(_ name (lambda formals . body))
(old-define name (let ([p (lambda formals . body)])
(set-procedure-property! p 'definition
'(lambda formals .
body))
p))]
[(_ (name . formals) . body)
(define name (lambda formals . body))]
[(_ . rest) (old-define . rest)])))
The parens are balanced in the above.
(define (foo x) x)))
But then you give this line which has an extra two close-parens. Where
is is supposed to fit?