function arguments and gensym



Ah, I too was caught in this confusion.

The point remains:
You can use x as an array,  either by
array(x,3),  or ... as in the example ... assigning as a hash array element,
x[4]:5.

Or you can give x a value of a list, by x:[1,1,1,1].

Or you can do BOTH.

And what should w[4]   mean? The user may not know. I didn't..

either 1. look for an array property on w if w is a local name
Or 2. evaluate w to x and look for an array property on x
Or 3. evaluate w to x and look for a value that is a list on x
Or 4. evaluate w to x and make a "complicated name" of a subscripted x
Or 5. if w has no value, make a "complicated name" of a subscripted w.

The discussion of whether x or w is to be treated differently if w is a
formal parameter to a function or the name of a locally bound variable in a
block is related perhaps.

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?

In Fortran, there is some confusion about an array w(10),  since the syntax
for a function call is the same... w(10). But no one considers that w(10)
means x(10) because  w is assigned the name x.  (There is the "equivalence"
statement, to confuse old Fortran hands, but this is not an incentive to
learn Fortran.)
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 8:10 AM
> To: fateman at cs.berkeley.edu; maxima at math.utexas.edu
> Subject: Re: [Maxima] function arguments and gensym
> 
> Thanks for the reply. To make sure I did the examples again
> >
> > ....
> >
> >> w:x;
> >> x[4]:5;
> >> x:[1,1,1,1,1,1,1,1];
> >> w[4];
> >>
> >> This is tricky! Now we still get 5. So maxima seems to prefer
> >> the array property of x above its value which is a list.
> >>
> >
> > No, the value of x is a list.  X has no array property.
> >
> But we do get 5!
> 
> :lisp (describe '$x);
> 
> $X - internal symbol in MAXIMA package
>  value:
>    ((MLIST SIMP) 1 1 1 1 1 1)
>  property MPROPS:
>    (NIL HASHAR #:G32536)    <======
>