plot2d (?) error



On Tue, Dec 2, 2008 at 11:46 PM, Robert Dodier <robert.dodier at gmail.com>wrote:

> These days I think I am in favor of Lisp-1 for Maxima.
> ...
> foo (x, k) := x[k] : x[k] + 1;
> ...
> I wonder whether x should be evaluated on the left-hand side.


As you're (implicitly) pointing out here, Maxima is really a Lisp-3 -- the
array value is different from the value value and the function value.
Actually, it's currently a complete mess, with our multiple ways of
representing arrays:

foo(x):=(x[1]:999, x)$
foo([1,2,3]) => [999,2,3]        -- x[k] evaluates x
q: [1,2,3]$
foo(q) => [999,2,3]
x[1] => x[1]

r[1]: 1 $
foo(r) => r
r[1] => 1              -- hmm
x[1] => 999

foo([1,2,3]) => [1,2,3]       -- oh, no!

So I agree with you that x[k] must refer to the *value* of x both on the
left and the right-hand side of assignments.

That still doesn't clean up our array mess in general, but it's a step in
the right direction.

           -s