[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] making lambdas more introspective
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] making lambdas more introspective |
Date: |
Mon, 30 May 2005 09:38:32 +0200 |
On 5/30/05, Michele Simionato <address@hidden> wrote:
>
> Are you saying that a macro
>
> (define-introspectively (foo . args)
> ...)
>
> would make the compiler happy? In other words, we should
> redefine "define", not "lambda"?
Yes, once you use a different name, the expansion doesn't
loop.
> That's good, so we could also store the name of the function,
> which is even more useful than its arguments for documentation
> purposes.
> The only thing is, I would like the mechanism to work for
> inner defines too.
>
It should work:
#;1> (define-macro (defun n ll . body) `(define ,n (lambda ,ll ,@body)))
#;2> (defun foo (x) (+ x 1))
#;3> (foo 33)
34
#;4> (let () (defun foo (x) (+ x 1)) (foo 33))
34
cheers,
felix