home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / lisp / 3218 < prev    next >
Encoding:
Text File  |  1993-01-09  |  1.3 KB  |  37 lines

  1. Path: sparky!uunet!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: (SETF VALUES)
  5. Date: 9 Jan 1993 12:29:24 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 24
  8. Distribution: world
  9. Message-ID: <1imgf4INNmf@early-bird.think.com>
  10. References: <1993Jan6.213139.27999@kronos.arc.nasa.gov> <FY.93Jan6155542@hardwick.lucid.com> <SJAMESON.93Jan8084615@fergie.atl.ge.com>
  11. NNTP-Posting-Host: gandalf.think.com
  12.  
  13. In article <SJAMESON.93Jan8084615@fergie.atl.ge.com> sjameson@atl.ge.com writes:
  14. >In article <FY.93Jan6155542@hardwick.lucid.com> fy@lucid.com (Frank Yellin) writes:
  15. >> >   Is it possible to implement (SETF VALUES) in a Lisp which doesn't
  16. >> >   already do this?
  17. >Pardon my ignorance here, but could you explain in what situations one would
  18. >wish to do this?
  19.  
  20. The normal multiple-value assignment operators only allow you to assign to
  21. variables, but you might want to assign to a set of generalized references.
  22. Here's a simple, contrived example:
  23.  
  24. (defstruct (q-and-r (:conc-name qr-))
  25.   quotient
  26.   remainder)
  27.  
  28. (defvar *qr* (make-q-and-r))
  29. ...
  30. (setf (values (qr-quotient *qr*) (qr-remainder *qr*))
  31.       (floor numerator denominator))
  32. -- 
  33. Barry Margolin
  34. System Manager, Thinking Machines Corp.
  35.  
  36. barmar@think.com          {uunet,harvard}!think!barmar
  37.