home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / mcl / 1197 < prev    next >
Encoding:
Text File  |  1992-08-12  |  1.6 KB  |  48 lines

  1. Path: sparky!uunet!sun-barr!ames!data.nas.nasa.gov!taligent!apple!cambridge.apple.com!bill@cambridge.apple.com
  2. From: bill@cambridge.apple.com (Bill St. Clair)
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: Apply
  5. Message-ID: <9208121750.AA04124@cambridge.apple.com>
  6. Date: 12 Aug 92 18:52:59 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 34
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Full-Name: Bill St. Clair
  11. Original-To: owens@cs.uchicago.edu
  12. Original-Cc: info-mcl
  13.  
  14. >From: owens@cs.uchicago.edu
  15. >Date: Wed, 12 Aug 92 11:59:16 CDT
  16. >To: bill@cambridge.apple.com
  17. >Subject: Re: Apply
  18. >Newsgroups: comp.lang.lisp.mcl
  19. >Organization: Dept of Computer Science, The Univ of Chicago
  20. >Cc: 
  21. >
  22. >In article <9208121537.AA03113@cambridge.apple.com> you write:
  23. >
  24. >>[...]
  25. >>
  26. >>(defun make-menu-items (items)
  27. >>  (let (menu-items)
  28. >>    (dolist (item items)
  29. >>      (push (make-instance ...
  30. >>              :attached-function
  31. >>              #'(lambda (window)
  32. >>                  (declare (ignore window))
  33. >>                  (print item)))
  34. >>            menu-items)
  35. >>      ...)))
  36. >>
  37. >
  38. >
  39. >Bill, I almost posted this exact code fragment, but then I thought of
  40. >the buggy code that Rao posted the other day, and I couldn't remember
  41. >whether dolist was guaranteed to create a fresh binding for each
  42. >iteration.  Does your code create an :attached-function that, for each
  43. >of the menu items, prints the value taken on by ITEM during the last
  44. >iteration of the DOLIST?
  45.  
  46. As pointed out by Kim Barrett and Bob Cassells, my code is wrong.
  47. You need to create a fresh binding or use a mapping function.
  48.