|
| From: | Chicken Monk |
| Subject: | [Chicken-users] Re: eval and local variables |
| Date: | Wed, 09 May 2007 17:35:19 -0400 |
| User-agent: | Thunderbird 2.0.0.0 (Macintosh/20070326) |
Graham Fawcett wrote:
Try this instead:
(define-macro (eval-with-locals locals expr)
`((eval (list 'lambda ',locals ,expr)) ,@locals))
Example:
(define z 1000)
(let ((x 10)
(y 100)
(expr '(+ x y z)))
(eval-with-locals (x y) expr))
==> 1110
Cool! It's amazing how much is possible in Scheme. -- Chicken Monk "God loves ya. And she loves me too."
| [Prev in Thread] | Current Thread | [Next in Thread] |