I've had some students working on the innards of the SETF facility in
CLforJava. There are lot of subtleties involved in implementation of
DEFSETF et al, but they're slogging along and making good progress.
But the (setf (values... is interesting. After a (long) bit of study,
we understand the standard's verbiage of VALUES as a place. But I've
never seen an actual use of this facility. Could any care to post some
real (non-toy) uses of (setf (values.... ? thanks
Jerry
Jerry Boetje <···········@mac.com> writes:
> I've had some students working on the innards of the SETF facility in
> CLforJava. There are lot of subtleties involved in implementation of
> DEFSETF et al, but they're slogging along and making good progress.
> But the (setf (values... is interesting. After a (long) bit of study,
> we understand the standard's verbiage of VALUES as a place. But I've
> never seen an actual use of this facility. Could any care to post some
> real (non-toy) uses of (setf (values.... ? thanks
I use it sometimes when I'm looping with incremental processing that
returns two values, like read-from-string does. Here's a bunch of other
occurrences:
http://www.google.com/codesearch?q=%22setf+%28values%22&hl=en&btnG=Search+Code
Not all of them seem well-advised to me, but it's stuff that's out there
in the wild.
Zach
Thanks to all of you for you help. A couple of bells range (bulbs
lit?) when I went back (for the nth time) and read more carefully the
first step in the spec where it discusses 'SUBFORMS are evaluated'.
It's as if I mapped GET-SETF-EXPANSION over the VALUES forms and then
worked on the stores. Sounds like a good approach in fact.
Thanks folks. Looking forward to meeting you in Cambridge.
From: Pascal J. Bourguignon
Subject: Re: looking for interesting (setf (values.... examples
Date:
Message-ID: <87hc3oit8j.fsf@galatea.local>
Jerry Boetje <···········@mac.com> writes:
> I've had some students working on the innards of the SETF facility in
> CLforJava. There are lot of subtleties involved in implementation of
> DEFSETF et al, but they're slogging along and making good progress.
> But the (setf (values... is interesting. After a (long) bit of study,
> we understand the standard's verbiage of VALUES as a place. But I've
> never seen an actual use of this facility. Could any care to post some
> real (non-toy) uses of (setf (values.... ? thanks
This is equivalent to multiple-value-setq; I'd say that using one or
the other is a question of style. So your question reduces to whether
we know somebody with this style. The answer is yes.
For example:
http://code.google.com/p/jrm-code-project/source/browse/#svn/trunk/lambda/
uses it a lot.
Also the sources of McCLIM and CLOCC, and there's one additionnal
occurence in lisa/src/utils/utils.lisp
--
__Pascal Bourguignon__
Jerry Boetje <···········@mac.com> writes:
> we understand the standard's verbiage of VALUES as a place. But I've
> never seen an actual use of this facility. Could any care to post some
> real (non-toy) uses of (setf (values.... ? thanks
It's useful whenever you have a function that returns multiple values
that you need, and you just want to assign them to local or global
variables that you've already bound (i.e. you don't need to do a
multiple-value-bind).
Examples grepped out of my code:
Setting decoded time components again (inside a loop inside a multiple-
value-bind of those time components):
(setf (values s m h day month year dayweek)
(decode-universal-time ...))
Setting some variables from a function returning multiple values:
(setf (values rsidata avdown avup)
(rsi data-sequence rsidata
(rsi-period-of (top-level-interface chart))))
Setting some global variables:
(setf (values *order-form-last-x* *order-form-last-y*)
(top-level-interface-geometry form))
--
(espen)