multiple assignment stuff in src/mlisp.lisp



Hello,

I made a minor change to the multiple assignment stuff.
The results for inputs %i1--%i10 are the same as before.
One of the others changed.

(%i11) [i, i] : [1, 2];
(%o11)                       [1, 2]
(%i12) i;
(%o12)                          2
(%i13) a : [1, 2, 3, 4];
(%o13)                    [1, 2, 3, 4]
(%i14) (i : 2, [i, a[i]] : [4, 11]);         /* <--- DIFFERENT EFFECT HERE */
(%o14)                       [4, 11]
(%i15) a;
(%o15)                    [1, 11, 3, 4]
(%i16) [ a[1], a[2] ] : [ a[3], a[4] ];
(%o16)                       [3, 4]
(%i17) a;
(%o17)                    [3, 4, 3, 4]
(%i18) a : [1, 2, 3, 4];
(%o18)                    [1, 2, 3, 4]
(%i19) (i:0, [ a[i : i + 1], a[i : i + 1] ] : [ a[i : i + 1], a[i : i + 1] ]);
(%o19)                       [1, 2]
(%i20) a;
(%o20)                    [1, 2, 1, 2]

What's different is that array subscripts are evaluated before
any assignments are made (unless an assignment is a side-effect
of the subscript evaluation). This is an effort to make the place to
which an assigned value is copied independent of the other things
that might be assigned.

At this point these outputs all look reasonable to me.
As reasonable as they can be in the presence of side effects, anyway.

FWIW
Robert

--- mlisp.lisp  1 Mar 2007 00:16:49 -0000       1.34
+++ mlisp.lisp  6 Mar 2007 04:41:29 -0000
@@ -680,6 +680,9 @@
           (eq (caar vlist) 'mlist)
           (not (= (length tlist)(length vlist))))
       (merror "Illegal list assignment: different lengths of ~M and
~M." tlist vlist))
+  (setq tlist
+        (mapcar #'(lambda (x) (if (symbolp x) x `(,(car x) ((mquote)
,@(mapcar #'meval (cdr x))))))
+                tlist))
   (unless (and (listp vlist)
           (eq (caar vlist) 'mlist))
     (setf vlist (cons (car tlist) ;; if [a,b,c]:v  then make a list [v,v,v]