home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!kab
- From: kab (Kim Barrett)
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: Making a lambda-expr more like a fn
- Message-ID: <9211181648.AA09391@cambridge.apple.com>
- Date: 18 Nov 92 16:48:34 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 28
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
-
- > 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))
- > ,@body))
- >
- > In an artificial example..
- >
- > (let ((x 0))
- > (with-environment (env)
- > (setf counter-fn
- >
- (enclose '(lambda () (incf x)) env))))
- >
- > However...
- >
- > ? (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> ...".
-