[Openmcl-devel] Is it safe to make hash tables with non-standard tests?
ron at flownet.com
Sun Jul 14 21:44:54 CDT 2013
On Jul 14, 2013, at 7:29 PM, Kevin Reid wrote:
> On Jul 14, 2013, at 18:02, Ron Garret <ron at flownet.com> wrote:
>> EQUALP doesn't do the Right Thing with symbols:
>> ? (equalp 'foo "FOO")
>> ? (string= 'foo "FOO")
> If you want to make use of that equality, then it is in principle unsafe to use SXHASH as the hash function, because there is no guarantee (as far as I see in CLHS) that (= (sxhash 'foo) (sxhash "FOO")); therefore such a hash table may be inconsistent.
> Given that you aren't looking for portability, this is not a serious problem (assuming CCL does have this equality), but I think it's worth noting the dependence on that.
I was actually going to use (sxhash (string-upcase (princ-to-string thing))) as the hash function, and STRING-EQUAL as the test.
More information about the Openmcl-devel