gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] Two new tests for (SETF (VALUES ...) ...)


From: Camm Maguire
Subject: Re: [Gcl-devel] Two new tests for (SETF (VALUES ...) ...)
Date: 23 Oct 2002 01:00:23 -0400

Greetings!  Just a quick update on the setf:

I've looked briefly into the expander, and the 'defsetf' macro, and
can get things like the following pretty easily:

(defsetf values (&rest r) (nv) `(let ((q (multiple-value-list ,nv)) (i 0) (f 
'())) (dolist (z ,r (values (nreverse f))) (push `(setf z (nth i q)) f))))

VALUES

>(macroexpand '(setf (values x y z) (values 1 2 3)))

(LET* ((#:G2678 X) (#:G2679 Y) (#:G2680 Z) (#:G2681 (VALUES 1 2 3)))
  (LET ((Q (MULTIPLE-VALUE-LIST #:G2681)) (I 0) (F 'NIL))
    (DOLIST (Z (#:G2678 #:G2679 #:G2680) (VALUES (NREVERSE F)))
      (PUSH '(SETF Z (NTH I Q)) F))))
T

>(LET* ((#:G2678 X) (#:G2679 Y) (#:G2680 Z) (#:G2681 (VALUES 1 2 3)))
  (LET ((Q (MULTIPLE-VALUE-LIST #:G2681)) (I 0) (F 'NIL))
    (DOLIST (Z (#:G2678 #:G2679 #:G2680) (VALUES (NREVERSE F)))
      (PUSH '(SETF Z (NTH I Q)) F))))


Apart from the quoting needed on the target variables, there only
seems to be a facility for a *single* 'store' variable, which cannot
be assigned to all of the values of a multiple value form, at least
not in any way that I can see.  My understanding is that
macroexpansions resulting from the define-setf-method specifications
also have this property, although this statement has not been completely
verified.  

Advice?

Take care,

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]