Robert Dodier escribi?:
> 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).
>
In addition, you can access the elements of list 'a' calling function
'part':
(%i6) part(a,1);
(%o6) 1
(%i7) part(a,2);
(%o7) 2
(%i8) part(a,3);
(%o8) 3
--
Mario