[Maxima] arrays/lists with multi-idices
Robert Dodier
robert.dodier at gmail.com
Tue Jun 19 08:24:06 CDT 2007
On 6/19/07, Fabrizio Caruso <caruso at dm.unipi.it> wrote:
> (%i22) foo (x) := block (local (b), array (b, 5), arrayapply(b,[1,2,3]) :
> x, listarray (b));
Oh -- array(b, 5) declares an array with a fixed number of indices
(namely 1). If you want to use a variable number of indices,
either the array declaration must be more clever
(e.g. apply(array, append(b, L)) where L is a list of integers)
or just omit the declaration so the array is undeclared and
therefore a hash table.
e.g.
foo (x, [L]) := block (local (b), b [L] : x, arrayinfo (b));
foo (100, 1, 2, %pi, a);
=> [hashed, 1, [[1, 2, %pi, a]]]
arrayinfo (b);
=> (error: no such array)
Sorry this is so confusing.
Robert
More information about the Maxima
mailing list