global defined lists and hashed arrays in function bodies



In the first case, you are
(($X ARRAY) 2)
but the second one is
((MSETQ) (($U ARRAY) 1) 2)

IOW, due to the syntax in creating an unnamed hashed array, you are also
binding a value to the first element of "u", and that is evaluated in
"bar(y)".

For "foo(x)", there is no value bound, and it resolves to only the symbol.

>Hello.
>
>The function definition of foo and bar seem to be the same. 
>The results are different. Why? 
>I had expected  foo(y); => y+2
>Does mdefine react on the symbol's properties?
>
>Volker van Nek
>
>(%i2) x:[2]$
>(%i3) properties(x);
>(%o3) [value]
>(%i4) foo(x):=x+x[1]$
>(%i5) :lisp $_
>((MDEFINE) (($FOO) $X) ((MPLUS) $X (($X ARRAY) 1)))
>(%i5) foo(y);
>(%o5) y+y[1]
>
>(%i6) u[1]:2$
>(%i7) properties(u);
>(%o7) ["hashed array"]
>(%i8) bar(u):=u+u[1]$
>(%i9) :lisp $_
>((MDEFINE) (($BAR) $U) ((MPLUS) $U (($U ARRAY) 1)))
>(%i9) bar(y);
>(%o9) y+2