1. There is nothing to prevent you from writing an entirely different top
level for Maxima. Using the existing framework as a start, if you wish, you
can design a different programming language, a compiler, etc.
With such a rewrite you can revisit all kinds of questions from
capitalization to binding, to the treatment of arrays.
There is, in commercial Macsyma, a feature that allows you to write in
Matlab syntax.
2. It is probably a bad idea to make incompatible changes to the existing
language.
3. The examples given of errors continue, I think, to illustrate "user
error" though perhaps Maxima has confusing semantics with regard to arrays.
Lisp had confusing array semantics too, at least in 1966.
Consider
h[1]; is h[1]. H has no value or properties and so is "quoted".
h:r+s;
h[1]; is (r+s)[1]. H is neither an array nor a list, but a value.
array(h,3);
h[1]; is h[1]. H has an array property so h[1] is a reference into
it.
h; is still r+s.
h:[a,b,c] sets the value of h to a list
h[1]; is h[1] because the array property takes preference.
The deficiency here is related to using the same syntax [] for at least 4
things. 1. defining a list as [a,b,c]. 2. extracting from a list h[1]. 3.
extracting from an array h[1]. 4. having a subscripted variable.
The confusion that some users may have from this is understandable. The user
confusion should not be corrected by taking the view that erroneous user
programs should be adopted as a model for correct programs.
A program that uses x as a subscripted indeterminate, e.g. x[1], x[2],
UNEVALUATED, should not, every so often, try to do
X[i]: some value
Or
X: some value.
This is probably a error, since x[1] then becomes ambiguous in the user's
mind. It is of course not ambiguous to Maxima, which does something
specific, but perhaps not what the user had in mind.
Here's a way out of the situation.
Never use the syntax [] to extract from a list. That is, choose another
syntax. For example,
H:[a,b,c]
H[[1]] -> a.
In the array-accessing expression Q[1], the name Q is not evaluated. If Q
is an array, Q[1] is found and returned. If Q is not an array, Q[1] is a
subscripted name.
If you want to make an array S, and assign Q:S and refer indirectly to S
through Q, then do something like arrayref(Q,1). Arrayref evaluates its
arguments.
RJF
....
> w:x;
> x[4]:5;
> x:[1,1,1,1,1,1,1,1];
> w[4];
>
> This is tricky! Now we still get 5. So maxima seems to prefer
> the array property of x above its value which is a list.
No, the value of x is a list. X has no array property.
The notation
>
> w:x;
> x:[1,1,1,1,1,1,1,1];
> w[4];
>
> Now x has no array property so its value is inspected. We get 1.
>
> x[4]:5;
> x:[1,1,1,1,1,1,1,1];
> x[4];
>
> We get 5. Maxima prefers again the array property.
No, the value of x is a list.