<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">EQUALP doesn't do the Right Thing with symbols:<div><br></div><div><div><div>? (equalp 'foo "FOO")</div><div>NIL</div><div>? (string= 'foo "FOO")</div><div>T</div></div><div><br></div><div>Also, EQUALP is a security risk.  It's vulnerable to denial-of-service attacks if you feed it e.g. a circular list.</div><div><br></div><div>rg</div><div><div><br><div><div>On Jul 14, 2013, at 4:49 PM, Tom Emerson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">You don't need to: using 'equal as your test achieves the same result.<div><br></div><div><div>Welcome to Clozure Common Lisp Version 1.9-r15757  (LinuxX8664)!</div><div><div>? (defvar foo (make-hash-table :test 'equal))</div>
<div>#<HASH-TABLE :TEST EQUAL size 0/60 #x3020006F2C3D></div><div>? (setf (gethash "abc" foo) 100)</div><div>100</div><div>? (gethash "abc" foo)</div><div>100</div><div>T</div><div>? (gethash "ABC" foo)</div>
<div>NIL</div><div>NIL</div></div><div><br></div><div>If instead you want the test to be string-equal then use 'equalp</div><div><br></div><div><div>? (setq foo (make-hash-table :test 'equalp))</div><div>#<HASH-TABLE :TEST EQUALP size 0/60 #x3020006F9D5D></div>
<div>? (setf (gethash "abc" foo) 100)</div><div>100</div><div>? (gethash "abc" foo)</div><div>100</div><div>T</div><div>? (gethash "ABC" foo)</div><div>100</div><div>T</div></div><div><br></div>
<div>This is portable: same results in SBCL.</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jul 14, 2013 at 3:53 PM, Ron Garret <span dir="ltr"><<a href="mailto:ron@flownet.com" target="_blank">ron@flownet.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I need a string= hash table, which is not in the standard.  It appears that CCL can actually make one:<br>

<br>
(make-hash-table :test 'string= :hash-function 'sxhash)<br>
<br>
This seems to do the Right Thing, but  it's not documented.  Is it safe to use this feature?<br>
<br>
rg<br>
<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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Tom Emerson<br><a href="mailto:tremerson@gmail.com" target="_blank">tremerson@gmail.com</a><br><a href="http://www.dreamersrealm.net/tree" target="_blank">http://www.dreamersrealm.net/tree</a>
</div></div></div>
</blockquote></div><br></div></div></div></body></html>