From: Jerry Boetje
Subject: looking for interesting (setf (values.... examples
Date: 
Message-ID: <d61c9025-214c-4a49-872d-d89a3762eb22@l16g2000yqo.googlegroups.com>
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

From: Zach Beane
Subject: Re: looking for interesting (setf (values.... examples
Date: 
Message-ID: <m38wp0vf3q.fsf@unnamed.xach.com>
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
From: Jerry Boetje
Subject: Re: looking for interesting (setf (values.... examples
Date: 
Message-ID: <33f4a406-d7c4-4ce1-b080-1382942399dc@l16g2000yqo.googlegroups.com>
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__
From: Espen Vestre
Subject: Re: looking for interesting (setf (values.... examples
Date: 
Message-ID: <m1ljt0k77f.fsf@vestre.net>
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)