array arguments to function



On 1/28/08, Thomas Widlar <twidlar at yahoo.com> wrote:

> Can an array be passed to a function to work on, g(f)?
>
> Or must one pass the elements of arrays, g(f[1],f[2])?

Maxima doesn't handle array arguments consistently. Consider this:

  g(x) := x[1] : 1234;

Whether g changes the actual argument depends on the kind
of object that the actual argument is. If x is a list or a so-called
"fast" array, it is changed, but if x is an ordinary declared or
undeclared array, it is not.

This behavior is a bug. I don't know if g should consistently change
the actual argument or consistently not change it, but I am sure that
it should be consistent.

If you only want to read values in an array argument, I think
there is no problem. So maybe you can tell us what you are
trying to do.

best

Robert