Maxima storage class semantics



I sent this to Daniel a couple of hours ago, intending to send it to
the whole lis....

> I agree to some extent here... Maxima has confusing semantics with
> regard to lists, matrices, arrays, subscripted variables, and soforth.

Agreed.  For the rest, I think this proposal is going in precisely the
wrong direction, with multiple special-purpose mechanisms defined by a
mixture of semantics and implementation matters.  I have previously
proposed a simpler system, which separates semantics and
implementation cleanly.  I will outline more details later.

> To kick it off, I think maxima should have (at least) the following
> types of things:
>
> 1) lists, which are just like lisp lists, current maxima lists are fine

> 2) vectors, which have mathematical semantics and O(1) indexing.

What exactly do you mean by "mathematical semantics"?
Why are you requiring that semantics be aligned with performance
characteristics?

> 3) Arrays, which are like common lisp "vectors"

What exactly are the properties you want?

> 4) Hash tables, which are like common lisp hash tables but can be
> accessed in a similar way to an array, except the index need not be an
> integer.

Why is this different from a list or an array?

> 5) Numerical arrays, which are like common lisp arrays specialized to
> double floats.

This is an implementation matter.  Are the semantics the same as
arrays?  If we later add quad-precision floats, is that a different
type?

> 6) Matrices, which should have mathematical semantics.

What exactly do you want here?  I assume you want to allow general
values in each entry, not just numbers.  If they entries happen to be
double-floats, how does this relate to your "numeric arrays"?

> When assigning any of these to a named variable, they should be
> assigned to the "value" cell of that variable.

That is an implementation detail.  I think what you intend is that the
objects above be first-class objects, which can be assigned to
variables, passed as arguments, etc.