From: Spiros Bousbouras on
In http://www.lispworks.com/documentation/HyperSpec/Body/m_rotate.htm
we read: "In the form (rotatef place1 place2 ... placen), the values
in place1 through placen are read and written". Does it mean "saved"
instead of "written" ?

And while I'm at it, is there an errata list for the HS somewhere ?
From: Vassil Nikolov on

On Wed, 4 Nov 2009 18:17:12 -0800 (PST), Spiros Bousbouras <spibou(a)gmail.com> said:

> In http://www.lispworks.com/documentation/HyperSpec/Body/m_rotate.htm
> we read: "In the form (rotatef place1 place2 ... placen), the values
> in place1 through placen are read and written". Does it mean "saved"
> instead of "written" ?

No; here "write" is used in a sense similar to the first meaning of
"write" given in the Glossary.

> And while I'm at it, is there an errata list for the HS somewhere ?

I am only aware of one distributed over Usenet (and the Web)...

---Vassil.


--
"Even when the muse is posting on Usenet, Alexander Sergeevich?"
From: Vassil Nikolov on

On Wed, 04 Nov 2009 21:39:02 -0500, Vassil Nikolov <vnikolov(a)pobox.com> said:

> On Wed, 4 Nov 2009 18:17:12 -0800 (PST), Spiros Bousbouras <spibou(a)gmail.com> said:

>> In http://www.lispworks.com/documentation/HyperSpec/Body/m_rotate.htm
>> we read: "In the form (rotatef place1 place2 ... placen), the values
>> in place1 through placen are read and written". Does it mean "saved"
>> instead of "written" ?

> No; here "write" is used in a sense similar to the first meaning of
> "write" given in the Glossary.

Or maybe I misunderstood the question (wasn't it at least a little
ambiguous, though?). Perhaps a better answer would be that the fact
that the values read are _saved_, if that means "assigned to
temporary variables inside ROTATEF", is an internal implementation
detail, while the fact that the values of the places are read, and
then values (which form a permutation of the values read) are
_written_ into those places, is part of ROTATEF's specification.

---Vassil.


--
"Even when the muse is posting on Usenet, Alexander Sergeevich?"
From: Kaz Kylheku on
On 2009-11-05, Spiros Bousbouras <spibou(a)gmail.com> wrote:
> In http://www.lispworks.com/documentation/HyperSpec/Body/m_rotate.htm
> we read: "In the form (rotatef place1 place2 ... placen), the values
> in place1 through placen are read and written". Does it mean "saved"
> instead of "written" ?

The text makes no sense. Taken as is, it implies that the values are
stored twice. It looks like the result of careless edit; as if
originally, the text had said that all of the values are read and written, and
then went on to explain what exactly happens.

You can fix it simply by deleting the word "then"; it is the "then" separating
the "written" and "stored" which makes it look like they are distinct,
sequenced events, rather than independent remarks on the same situation.

Also, notably abesent is a ``Side Effects:'' paragraph, but this inconsistency
is repeated elsewhere in the document, like SETF/PSETF.

For instance for the PUSH macro we have:

``Side Effects:

The contents of place are modified.''
From: Vassil Nikolov on

On Thu, 5 Nov 2009 04:41:02 +0000 (UTC), Kaz Kylheku <kkylheku(a)gmail.com> said:

> On 2009-11-05, Spiros Bousbouras <spibou(a)gmail.com> wrote:
>> In http://www.lispworks.com/documentation/HyperSpec/Body/m_rotate.htm
>> we read: "In the form (rotatef place1 place2 ... placen), the values
>> in place1 through placen are read and written". Does it mean "saved"
>> instead of "written" ?

> The text makes no sense. Taken as is, it implies that the values are
> stored twice. It looks like the result of careless edit; as if
> originally, the text had said that all of the values are read and written, and
> then went on to explain what exactly happens.

> You can fix it simply by deleting the word "then"; it is the "then" separating
> the "written" and "stored" which makes it look like they are distinct,
> sequenced events, rather than independent remarks on the same situation.

It seems I was more wrong than I thought earlier in my preceding
responses---quite wrong, in fact, and it indeed is proper that it
should be "saved" there (have I been just not noticing that
"then"...). In other words, it is specified that _all_ values are
obtained _before_ _any_ place is changed, which would matter in case
the value of one of the places depends on the value of another.
That is independent of any side effects which might occur while
accessing a place.

In other words, assuming that no side effects are taking place while
accessing P1 or P2, and assuming that fresh symbols are used as
needed,

(rotatef p1 p2)

must _not_ be executed as if it expanded into

;; (i)
(let (t1)
(setf t1 p1)
(setf p1 p2)
(setf p2 t1))

but it must be executed as if it expands into

;; (ii)
(let (t1 t2)
(setf t1 p1)
(setf t2 p2)
(setf p1 t2)
(setf p2 t1))

Now I can even actually recognize this as being related to the
notorious inability of Algol's call-by-name to support a universal
swapping operation, with the essence of the counterexample being

(rotatef n (aref a n))

---note how there are no side effects when accessing either N or
(AREF A N) and how (i)'s way from above would lead to

(let (t1)
(setf t1 n)
(setf n (aref a n))
(setf (aref a n) t1))

doing the wrong thing.

---Vassil.


--
"Even when the muse is posting on Usenet, Alexander Sergeevich?"