Is the following behaviour intended?
suppose we have the following code,
(actually I forgot to make the h in func1 local)
----------------------------------------------------
func1(a) := block(
h : a,
return(h)
);
func2(a) := block(
[res,h],
h : 77,
print(h),
res : h+func1(a),
print(h),
return(res)
);
func2(1);
-----------------------------------------------------
Maxima gives
-----------------------------------------------------
~$ maxima -b scope-test2.max
Maxima 5.15.0 http://maxima.sourceforge.net
Using Lisp SBCL 1.0.11.debian
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) batch(scope-test2.max)
batching /home/myuser/scope-test2.max
(%i2) func1(a) := block(h : a, return(h))
(%o2) func1(a) := block(h : a, return(h))
(%i3) func2(a) := block([res, h], h : 77, print(h), res : func1(a) + h,
print(h),
return(res))
(%o3) func2(a) := block([res, h], h : 77, print(h), res : func1(a) + h,
print(h),
return(res))
(%i4) func2(1)
77
1
(%o4) 78
--------------------------------------------------------
question: why does func1 change the local variable of func2 ???
Andre