Hello to all Derivers
If we define the functions:
add12(v):=PROG(v SUB 1:+1,v SUB 2:+2)
test1(x,y):=PROG(x:=[100,200],y:=x, add12(x),[x,y])
test2(x,y):=PROG(x:=[100,200],y:=x, add12(y),[x,y])
test3(x,y):=PROG(x:=[100,200],y:=x+[0,0],add12(y),[x,y])
Then,
test1() --> [[101,202],[101,202]]
test2() --> [[101,202],[101,202]]
test3() --> [[100,200],[101,202]]
It results that in the user functions test1 and test2, the local variables
(vectors) x and y are "synonymous" (i.e. have the same address in memory)!
Normally, test2() should be equivalent to test3(). It would be interesting
to know if this behavior was deliberated (as in MAPLE) or not.
Ignoring this treatment for vectors, correct functions may produce wrong
results and the debug is difficult.
Cheers,
V. Anisiu
|