This explanation is more based on history than optimal design.
The decision to have a separate function cell in Common Lisp was probably
based on the history of Maclisp and Interlisp. The Scheme dialect broke with
that tradition.
The tradition of Maclisp was used in Macsyma/Maxima.
The notion of an abstract object like a matrix or a sparse matrix as a value
of a variable V seems fine in isolation.
The notion of a storage system like an array, a hashed array, an array of
functions ... associated with a scalar name A is different. Or at least has
been different historically.
Because it is possible to store a matrix in an array, these ideas have been
conflated in a number of programming languages, but they are different.
For example, square matrices of a particular size, say 4X4, with elements
that are from a commutative ring form a ring, with the usual notion of
matrix multiplication and with a left (or right) multiplicative identity the
4x4 matrix with 1's on the diagonal, etc.
Arrays do not have such mathematical baggage. Multiplying 2 arrays might be
done element by element. If they are conformable, at least. Or might be
undefined. After all, an array might store social security numbers, and
another might store salaries. Why multiply them?
Lists used as 1Xn matrices are structure-abstraction puns, and invite
misuses.
If it is any consolation, Mathematica ignored several decades of experience
with this problem and even went so far as to fail to distinguish between row
and column vectors.
Arrays should be used for storing information. A matrix-valued variable is a
member of a non-commutative ring...
RJF
> -----Original Message-----
> From: maxima-bounces at math.utexas.edu [mailto:maxima-
> bounces at math.utexas.edu] On Behalf Of Michel Van den Bergh
> Sent: Saturday, January 13, 2007 2:49 PM
> To: maxima at math.utexas.edu
> Subject: function arguments and gensym
>
> >
> >
> >Foo(w):= Block([],
> >
> > array(w,100),
> > is this the same w? what does w[10]:300 really do? How about
> >return(w), does it return w's value or its array property?
> >
> >
> >
> I guess in any algol like language array(w,100) would be a local
> variable declaration which would shield
> the parameter w.... In maxima it gives the symbol w an array property,
> which is global since as you say
> Foo(w):=... only puts the *value* of w on the stack.....That's why I
> assume return(w) only returns the value
> of w but I have not checked it.
>
> Also in an algol like language (if you omit the declaration
> array(w,100)), w[10]:300 would change the tenth element
> of the array passed in w (array elements are passed by reference as an
> array is really a pointer).
>
> In maxima this happens for lists (as lists are values) but not for
> arrays. I find this a little bit depressing as in my
> mind arrays and lists are both sequence types and they should be treated
> in the same way as much as possible.
> If you set use_fast_arrays:true then arrays are saved in the value cell
> (as lisp arrays), but then such arrays
> have limitations compared to standard maxima arrays (this is probably
> just an implementation issue).
>
> I assume the decision to have a separate function cell in Common Lisp
> was for efficiency reasons. I don't
> seem any reason why that has been carried through to the maxima level
> (as maxima functions are not
> lisp functions anyway).
>
> Michel
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima