"Fabrizio Caruso" <fabrizio_caruso@hotmail.com> writes:
> (1) is there a way to pass an array/matrix as a parameter by
> reference? For example, in order to have a function change some
> elements in an array/matrix, do I always need to copy the whole
> array/matrix locally?
>
> (2) how do I declare an array local? do I need to use the "local"
> command. Putting it in brackets after the "block" command seems not
> to work.
I'd suggest to simply set
(c1) use_fast_arrays:true;
(d1) true
or to use `make_array' instead of `array'; this will give you lisp
arrays (and not only symbols which refer to such arrays via their
property list)
(c2) a:make_array('any,1);
(d2) #(NIL)
(c3) foo(x):=block([a:make_array('any,1)],x[0]:true,a[0]);
(d3) foo(x) := block([a : make_array('any, 1)], x : true, a )
0 0
(c4) foo(a);
(d4) false
(c5) a[0];
(d5) true
(c6) ?eq(a,d2);
(d6) true
You might also be interested in reading the thread `RE: array and
make_array' starting with
http://www.math.utexas.edu/pipermail/maxima/2002/001926.html
Wolfgang