multiple assignment stuff in src/mlisp.lisp



On 26 Feb 2007 23:09:34 +0100, Albert Reiner <areiner at tph.tuwien.ac.at> wrote:

> > (%i13) a : [1, 2, 3, 4];
> > (%o13)                    [1, 2, 3, 4]
> > (%i14) (i : 2, [i, a[i]] : [4, 11]);
> > (%o14)                       [4, 11]
> > (%i15) a;
> > (%o15)                    [1, 2, 3, 11]
>
> This I find a bit surprising; based on the earlier examples I would
> have expected a => [1, 11, 3, 4], i.e., I thought that the expressions
> on the left hand side are evaluated "in parallel",

I guess the current behavior results from

(map nil #'mset (cdr tlist)(cdr vlist))

so by the time the 2nd and later assignments are made, they
see the result of the first assignment ... I don't see a simple way
to insulate the assignments from each other. A complicated way
might be substitute gensyms, but that has the potential to leak
gensyms, aside from probably being too complicated.
Maybe build a lexical environment and evaluate it? Other ideas?

Robert