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

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!att!fang!tarpit!ge-dab!newshost.atl.ge.com!newshost.atl.ge.com!sjameson
  2. From: sjameson@atl.ge.com (Stephen M Jameson)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: (SETF VALUES)
  5. Date: 11 Jan 93 14:53:37
  6. Organization: GE Advanced Technology Laboratories
  7. Lines: 41
  8. Message-ID: <SJAMESON.93Jan11145337@fergie.atl.ge.com>
  9. References: <1993Jan6.213139.27999@kronos.arc.nasa.gov>
  10.     <FY.93Jan6155542@hardwick.lucid.com>
  11.     <SJAMESON.93Jan8084615@fergie.atl.ge.com>
  12.     <1imgf4INNmf@early-bird.think.com>
  13. Reply-To: sjameson@atl.ge.com
  14. NNTP-Posting-Host: retaxes.atl.ge.com
  15. In-reply-to: barmar@think.com's message of 9 Jan 93 12:29:24 GMT
  16.  
  17. In article <1imgf4INNmf@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
  18. > In article <SJAMESON.93Jan8084615@fergie.atl.ge.com> sjameson@atl.ge.com writes:
  19. > >In article <FY.93Jan6155542@hardwick.lucid.com> fy@lucid.com (Frank Yellin) writes:
  20. > >> >   Is it possible to implement (SETF VALUES) in a Lisp which doesn't
  21. > >> >   already do this?
  22. > >Pardon my ignorance here, but could you explain in what situations one would
  23. > >wish to do this?
  24. > The normal multiple-value assignment operators only allow you to assign to
  25. > variables, but you might want to assign to a set of generalized references.
  26. > Here's a simple, contrived example:
  27. > (defstruct (q-and-r (:conc-name qr-))
  28. >   quotient
  29. >   remainder)
  30. > (defvar *qr* (make-q-and-r))
  31. > ...
  32. > (setf (values (qr-quotient *qr*) (qr-remainder *qr*))
  33. >       (floor numerator denominator))
  34.  
  35. Thank you, I understand now.  I don't have a Cltl2 or draft standard handy, but
  36. isn't there such a thing as multiple-value-setf which would serve exactly this
  37. purpose? 
  38.  
  39.  
  40. > -- 
  41. > Barry Margolin
  42. > System Manager, Thinking Machines Corp.
  43. > barmar@think.com          {uunet,harvard}!think!barmar
  44. --
  45. Steve Jameson                 General Electric Aerospace / Martin Marietta
  46. sjameson@atl.ge.com           Advanced Technology Laboratories
  47.                               Moorestown, New Jersey              
  48. ****************************************************************************
  49. **  . . . but I do not love the sword for its sharpness, nor the arrow    **
  50. **  for its swiftness, nor the warrior for his glory.  I love only that   **
  51. **  which they defend . . .                                               **
  52. **    -- Faramir, "The Two Towers"                                        **
  53. ****************************************************************************
  54.