arrays/lists with multi-idices



Hi again

Sorry but I don't know hot to force arrays to be local.
There must be something I am missing.

For instance:
foo(x):= block([b],b:make_array('hashed,3),b[1]:x);

will change b[1] after its execution.

Moreover I would like to use things like
b[5,2,3,4] where the number of arguments is a parameter.

How do I create a d-dimensional array where d is an argument?

How do I tell make_array that the index should be a list?
If I do it the simple way I get the following error message:
"
(%i44) foo(x):= block([b],b:make_array('hashed,4),b[[1,3,3]]:x,print(x));
(%i45) foo(10);
Maxima encountered a Lisp error:

 Error during processing of --eval option "(cl-user::run)":

  invalid index ((MLIST SIMP) 1 3 3) in #(NIL NIL $HASHED NIL NIL #:G1210)

Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
"

  Fabrizio



On Mon, 18 Jun 2007, Richard Fateman wrote:

> I think you could use a hash array with a single index, but that index is a
> compound object.
> For example,  b[f(1,2,5)]  or even    b[[1,2,5]].
> 
> There is also a local declaration inside a block. Something like
>  local(b), 
>  
> 
> > -----Original Message-----
> > From: maxima-bounces at math.utexas.edu 
> > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Fabrizio Caruso
> > Sent: Monday, June 18, 2007 7:57 AM
> > To: maxima at math.utexas.edu
> > Subject: arrays/lists with multi-idices
> > 
> > Hi all!
> > 
> > I have the following problem,
> > I have a function which should uses
> > arrays with multi-idices of length
> > given by a parameter, i.e.
> > I would like to have some thing like:
> > 
> > b[1,2,5] (where the num. of arg. is a paramenter)
> > or
> > b[1][2][5]
> > 
> > I would also like to avoid using a global "b".
> > 
> > In other CAS such as Maple this is done by defining
> > b as local and then by doing something like
> > 
> > b(op([...,...,...]):...
> > 
> > Is there in Maxima a way to do something like that
> > or similar to that?
> > 
> >   Fabrizio
> > 
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> > 
>