>>>>> "Volker" == van Nek <van.Nek at gmx.net> writes:
Volker> 1. (*) text/plain ( ) text/html
Volker> Am 22 Feb 2006 um 11:42 hat Stavros Macrakis geschrieben:
>> On 2/22/06, van.Nek at gmx.net <van.Nek at gmx.net> wrote:
>> > (%i1) foo(a):= bar(a)$
>> > (%i2) bar(x):= a$
>> > (%i3) foo(1);
>> > (%o3) 1
>> > (%i4) bar(1);
>> > (%o4) a
>> > (%i5) a:2$
>> > (%i6) foo(1);
>> > (%o6) 1
>> > (%i7) bar(1);
>> > (%o7) 2
>> >
>> > This should not be intended. A bug?
>>
>> What exactly do you find surprising?
Volker> Hello Stavros, that's what I expected:
Volker> (%i1) :lisp(setf a 2)
Volker> 2
Volker> (%i1) :lisp(defun bar (x) a)
Volker> BAR
Volker> (%i1) :lisp(defun foo (a) (bar a))
Volker> FOO
Volker> (%i1) :lisp(foo 1)
Volker> 2
I think this is not valid Common Lisp code. There is no such thing as
a global lexical, so (setf a 2) isn't legal, unless a has already been
declared a special variable via defvar or defparameter or declare.
If you do that, then lisp will return the same answer as maxima
because the call to foo binds a (a special variable) to 1, which is
what bar sees and returns.
That it works for you just means the Lisp implementation you are using
has global lexicals of some sort.
Ray