Re: rotatef mystery



Ken Tilton <kennytilton@xxxxxxxxxxxxx> writes:

Saw this in the doc for rotatef, don't get it:

"If a place produces more values than there are store variables, the
extra values are ignored. If a place produces fewer values than there
are store variables, the missing values are set to nil. "

OK: (rotatef x y z)

How does a place, say, y produce more values than there are store
variables?!

kt


(defparameter *a* 1)
(defparameter *b* 1)
(defparameter *c* 1)

(defun fun () (values *a* *b* *c*))
(defun (setf fun) (val)
(setf *a* val
*b* (* val val)
*c* (* val val val))
(values *a* *b* *c*))

(define-symbol-macro y (fun))

Have fun!

(I don't know how y will behave in rotatef, no time now to find out).

--
__Pascal Bourguignon__ http://www.informatimago.com/

COMPONENT EQUIVALENCY NOTICE: The subatomic particles (electrons,
protons, etc.) comprising this product are exactly the same in every
measurable respect as those used in the products of other
manufacturers, and no claim to the contrary may legitimately be
expressed or implied.
.



Relevant Pages

  • rotatef mystery
    ... Saw this in the doc for rotatef, ... If a place produces fewer values than there are store variables, the missing values are set to nil. ... "We are what we pretend to be." ... -Kurt Vonnegut ...
    (comp.lang.lisp)
  • Re: rotatef mystery
    ... Ken Tilton wrote: ... If a place produces fewer values than there are store variables, the missing values are set to nil. ... Closer to MOP & ContextL: http://common-lisp.net/project/closer/ ...
    (comp.lang.lisp)