global defined lists and hashed arrays in function bodies
Subject: global defined lists and hashed arrays in function bodies
From: van Nek
Date: Sun, 24 Aug 2008 13:56:35 +0200
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