Hi<div><br></div><div>this is what happened:</div><div><br></div><div>(defun f (lst) (equal (first lst) (second lst)))</div><div>(defun g () (let ((x (gensym))) `(,x ,x)))</div><div><br></div><div><div>? (g)</div><div>(#:G34410 #:G34410)</div>
<div>? (f '(#:G34410 #:G34410))</div><div>NIL</div><div>? (f (g))</div><div>T</div><div><br></div><div><br></div><div>I had the tendancy to think that everything that have the same printed form are equal; But can </div>
<div>someone explain why this is not so ? (as shown above and in the example by Jason below)</div><div><br></div><div>I may understand the following but I am not sure (need an expert explanation)</div><div><br></div><div>
? (equal #(1 2 3) #(1 2 3))</div><div>NIL</div><div><br></div><div>Kind regards</div><div>Taoufik</div></div><div><br></div><br><div class="gmail_quote">On Wed, Aug 1, 2012 at 9:32 PM, Jason Aeschliman <span dir="ltr"><<a href="mailto:j.aeschliman@gmail.com" target="_blank">j.aeschliman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">this may help:<div><br></div><div><div>(defun compare (x y)</div><div> (list x y (eq x y) (equal x y) (equalp x y)))</div>
<div><br></div><div>(let* ((x (gensym))</div><div> (y (read-from-string (prin1-to-string x))))</div>
<div> (list (compare x x)</div><div><span style="white-space:pre-wrap"> </span> (compare x y)))</div><div><br></div><br><div class="gmail_quote"><div><div class="h5">On Wed, Aug 1, 2012 at 3:28 PM, Ron Garret <span dir="ltr"><<a href="mailto:ron@flownet.com" target="_blank">ron@flownet.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div><br>
On Aug 1, 2012, at 12:22 PM, Taoufik Dachraoui wrote:<br>
<br>
> Ok thanks<br>
><br>
> I solved the problem by doing using (intern (symbol-name (gensym))) instead of (gensym)<br>
><br>
> I did not know that the generated symbols do not belong to any package:<br>
><br>
> (symbol-package '#:G34159)<br>
> > NIL<br>
<br>
</div>RTFM.<br>
<br>
<a href="http://clhs.lisp.se/Body/f_gensym.htm" target="_blank">http://clhs.lisp.se/Body/f_gensym.htm</a><br>
<br>
You might also want to take a look at GENTEMP.<br>
<div><br>
><br>
> Is there any reason for this? because usually a symbol is interned in the current package<br>
<br>
</div>Not when you make it with GENSYM (which uses MAKE-SYMBOL) The Lisp reader interns symbols in the current package, but MAKE-SYMBOL doesn't.<br>
<br>
You really should read the paper I pointed you to. All of it.<br>
<span><font color="#888888"><br>
rg<br>
</font></span></div></div><div><div><br><div class="im">
_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com" target="_blank">Openmcl-devel@clozure.com</a><br>
<a href="http://clozure.com/mailman/listinfo/openmcl-devel" target="_blank">http://clozure.com/mailman/listinfo/openmcl-devel</a><br>
</div></div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>
<a href="http://clozure.com/mailman/listinfo/openmcl-devel" target="_blank">http://clozure.com/mailman/listinfo/openmcl-devel</a><br>
<br></blockquote></div><br>