regular behaviour ?



On 5/15/10, Mario Maio <mario.maio at aruba.it> wrote:

> Sorry for the probable trivial question, I'm an occasional user. I'd
> just like to know if the following behaviour is normal:
>
> (%i1) a[2]:45;
> (%o1)                                 45
> (%i2) a;
> (%o2)                                  a
> (%i3) a:[1,2,3];
> (%o3)                              [1, 2, 3]
> (%i4) a[2];
> (%o4)                                 45
> (%i5) a[1];
> (%o5)                                 a
>                                         1

Well, the initial a[2]:45 creates a so-called undeclared array
(i.e. a hash table) named a.
[1, 2, 3] is a list, which is distinct from an undeclared-array,
and it is assigned as the value of a.
It's possible in Maxima to have different kinds of things
associated with the same symbol -- Maxima is a "Lisp-2"
in language war terminology. So an expression like a[1] or
a[2] has to be disambiguated -- from the evidence it appears
Maxima has chosen the undeclared array over the value of a
(a list in this case).

FWIW

Robert Dodier