home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / lisp / mcl / 1618 < prev    next >
Encoding:
Internet Message Format  |  1992-11-18  |  1.3 KB

  1. 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
  2. From: kab (Kim Barrett)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: Making a lambda-expr more like a fn
  5. Message-ID: <9211181648.AA09391@cambridge.apple.com>
  6. Date: 18 Nov 92 16:48:34 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 28
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10.  
  11. > While reading the messages about turning lambda expressions
  12. > into functions, it seemed to me that the following might be reasonable...
  13. > (defmacro with-environment ((var) &body body &environment env)
  14. >     `(let ((,var ',env))
  15. >        ,@body))
  16. > In an artificial example..
  17. > (let ((x 0))
  18. >         (with-environment (env)
  19. >                 (setf counter-fn
  20. >                                                                                 
  21. (enclose '(lambda () (incf x)) env))))
  22. > However...
  23. > ? (let ((x 'non-nil-environment))
  24. >     (declare (ignore x))
  25. >     (with-environment (var) var))
  26. > #<BOGUS object @ #x5DF871>
  27. > ?
  28. > Does this work in any Lisp?
  29. > Should it?
  30.  
  31. Macro environments are specified to have dynamic extent.  See CLtL2, p.203, in 
  32. the paragraph beginning "X3J13 voted in March 1989 <117> ...".
  33.