home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!think.com!barmar
- From: barmar@think.com (Barry Margolin)
- Newsgroups: comp.lang.lisp
- Subject: Re: (SETF VALUES)
- Date: 9 Jan 1993 12:29:24 GMT
- Organization: Thinking Machines Corporation, Cambridge MA, USA
- Lines: 24
- Distribution: world
- Message-ID: <1imgf4INNmf@early-bird.think.com>
- References: <1993Jan6.213139.27999@kronos.arc.nasa.gov> <FY.93Jan6155542@hardwick.lucid.com> <SJAMESON.93Jan8084615@fergie.atl.ge.com>
- NNTP-Posting-Host: gandalf.think.com
-
- In article <SJAMESON.93Jan8084615@fergie.atl.ge.com> sjameson@atl.ge.com writes:
- >In article <FY.93Jan6155542@hardwick.lucid.com> fy@lucid.com (Frank Yellin) writes:
- >> > Is it possible to implement (SETF VALUES) in a Lisp which doesn't
- >> > already do this?
- >Pardon my ignorance here, but could you explain in what situations one would
- >wish to do this?
-
- The normal multiple-value assignment operators only allow you to assign to
- variables, but you might want to assign to a set of generalized references.
- Here's a simple, contrived example:
-
- (defstruct (q-and-r (:conc-name qr-))
- quotient
- remainder)
-
- (defvar *qr* (make-q-and-r))
- ...
- (setf (values (qr-quotient *qr*) (qr-remainder *qr*))
- (floor numerator denominator))
- --
- Barry Margolin
- System Manager, Thinking Machines Corp.
-
- barmar@think.com {uunet,harvard}!think!barmar
-