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

  1. Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!rp23+@andrew.cmu.edu
  2. From: rp23+@andrew.cmu.edu (Ray Pelletier)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: Making a lambda-expr more like a fn
  5. Message-ID: <If2aVF200WA1A1pQdJ@andrew.cmu.edu>
  6. Date: 18 Nov 92 15:59:13 GMT
  7. References: <9211160703.AA22159@gremlin>
  8. Sender: info-mcl-request@cambridge.apple.com
  9. Lines: 26
  10. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  11.  
  12. While reading the messages about turning lambda expressions
  13. into functions, it seemed to me that the following might be reasonable...
  14.  
  15. (defmacro with-environment ((var) &body body &environment env)
  16.     `(let ((,var ',env))
  17.        ,@body))
  18.  
  19. In an artificial example..
  20.  
  21. (let ((x 0))
  22.     (with-environment (env)
  23.            (setf counter-fn
  24.                                         (enclose '(lambda () (incf x)) env))))
  25.  
  26. However...
  27.  
  28. ? (let ((x 'non-nil-environment))
  29.     (declare (ignore x))
  30.     (with-environment (var) var))
  31. #<BOGUS object @ #x5DF871>
  32. ?
  33.  
  34. Does this work in any Lisp?
  35. Should it?
  36.  
  37. --Ray Pelletier
  38.