>
>
>here is a global variable called arrays, which is a list of arrays. If
>you want a local array, you need to
>use the function local inside the block with the array name as an argument.
>Otherwise, the array will be entered into the global array namespace.
>I think this is because Macsyma has array functions, and functions are
>global.
>Dan Stanger
>
>
>
The problem is the scope of an array which is a parameter. Here is the
example by miguel lopez
(%i1) g(s):=s[4];
(%i2) s[n]:=n^2;
(%i3) t[n]:=n^3;
(%i4) g(t);
16
The following definition only partially fixes the problem
g(s):=block([],local(s),s[4]);
Now g(t) returns 64 (as it should). However g(s) returns s_4 instead of 16....
Should one use
g(_s):=block([],local(_s),_s[4]);
and hope the user does not accidentally define an array _s?
Michel