--Alt-Boundary-28102.49107142
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
> 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
Thanks Ray,
that makes it clear.
Volker
--Alt-Boundary-28102.49107142
Content-type: text/html; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body
<?xml version="1.0" ?><html>
<head>
<title></title>
</head>
<body>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> (%i1) :lisp(setf a 2)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> 2</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> (%i1) :lisp(defun bar (x) a)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> BAR</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> (%i1) :lisp(defun foo (a) (bar a))</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> FOO</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> (%i1) :lisp(foo 1)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">>    Volker> 2</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">></span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> I think this is not valid Common Lisp code.  There is no such thing as</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> a global lexical, so (setf a 2) isn't legal, unless a has already been</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> declared a special variable via defvar or defparameter or declare.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">></span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> If you do that, then lisp will return the same answer as maxima</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> because the call to foo binds a (a special variable) to 1, which is</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> what bar sees and returns.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">></span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> That it works for you just means the Lisp implementation you are using</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> has global lexicals of some sort.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">></span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">> Ray</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Thanks Ray, </span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">that makes it clear.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Volker</span></font></div>
</body>
</html>
--Alt-Boundary-28102.49107142--