[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making a lambda-expr more like a fn
- To: Ray Pelletier <email@example.com>
- Subject: Re: Making a lambda-expr more like a fn
- From: kab (Kim Barrett)
- Date: Wed, 18 Nov 92 11:48:34
- Cc: firstname.lastname@example.org
> While reading the messages about turning lambda expressions
> into functions, it seemed to me that the following might be reasonable...
> (defmacro with-environment ((var) &body body &environment env)
> `(let ((,var ',env))
> In an artificial example..
> (let ((x 0))
> (with-environment (env)
> (setf counter-fn
(enclose '(lambda () (incf x)) env))))
> ? (let ((x 'non-nil-environment))
> (declare (ignore x))
> (with-environment (var) var))
> #<BOGUS object @ #x5DF871>
> Does this work in any Lisp?
> Should it?
Macro environments are specified to have dynamic extent. See CLtL2, p.203, in
the paragraph beginning "X3J13 voted in March 1989 <117> ...".