home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / lisp / 3131 < prev    next >
Encoding:
Text File  |  1992-12-22  |  1.2 KB  |  43 lines

  1. Newsgroups: comp.lang.lisp
  2. Path: sparky!uunet!paladin.american.edu!darwin.sura.net!spool.mu.edu!sdd.hp.com!saimiri.primate.wisc.edu!usenet.coe.montana.edu!rpi!news.ans.net!cmcl2!IMAGE.CS.NYU.EDU!marcoxa
  3. From: marcoxa@IMAGE.CS.NYU.EDU (Marco Antoniotti)
  4. Subject: setf methods for structure accessors used as parameters
  5. Message-ID: <9212222057.AA11609@IMAGE.CS.NYU.EDU>
  6. Sender: daemon@cmcl2.nyu.edu (Mr Background)
  7. Organization: New York University
  8. Distribution: comp.lang.lisp,comp.lang.clos
  9. Date: Tue, 22 Dec 1992 10:57:32 GMT
  10. Lines: 31
  11.  
  12. Hello there,
  13.  
  14. I am writing some code (priority queues) that uses a :key argument to
  15. extract information from some structure. The value passed as a :key
  16. argument is always funcalled within the code. At a certain point I
  17. need to actually 'setf' the structure slot 'keyed' by the :key value.
  18. I.e. I have code that looks like
  19.  
  20. (defun maximize (x &key (key an-x-accessor))
  21.  
  22.     ...
  23.  
  24.     (funcall an-x-accessor x)
  25. )
  26.  
  27. and I want to be able to do something like
  28.  
  29.  
  30. (defun do-maximize (x &key (key an-x-accessor))
  31.  
  32.     ...
  33.  
  34.     (setf (an-x-accessor x) somevalue)
  35. )
  36.  
  37. I checked CLtL2, but I couldn't come up with anything reasonable. I
  38. have a hunch that it is not possible.
  39.  
  40. Any idea?
  41.  
  42. Marco
  43.