From: Jeff
Subject: EQUALP in a hash table
Date: 
Message-ID: <ce3nr1$4jf@odak26.prod.google.com>
I'm having a difficult time understanding why the following does not
work as expected:

(setf test (make-hash-table :test #'equalp))
==> <#HashTable>

(setf (gethash "one" test) 1)
==> 1

(gethash "ONE" test)
==> NIL NIL
(equalp "one" "ONE") 
==> T

Thanks in advance for any insight :)

Jeff

From: Hannah Schroeter
Subject: Re: EQUALP in a hash table
Date: 
Message-ID: <ce3ot1$fhi$1@c3po.use.schlund.de>
Hello!

Jeff <···@insightbb.com> wrote:
>I'm having a difficult time understanding why the following does not
>work as expected:

>(setf test (make-hash-table :test #'equalp))
>==> <#HashTable>

>(setf (gethash "one" test) 1)
>==> 1

>(gethash "ONE" test)
>==> NIL NIL
>(equalp "one" "ONE") 
>==> T

>Thanks in advance for any insight :)

······@c3po:~ $ clisp -ansi                                             
[...]
[1]> (setf test (make-hash-table :test #'equalp))
#S(HASH-TABLE EQUALP)
[2]> (setf (gethash "one" test) 1)
1
[3]> (gethash "ONE" test)
1 ;
T
[4]> (equalp "one" "ONE") 
T

Kind regards,

Hannah.
From: JP Massar
Subject: Re: EQUALP in a hash table
Date: 
Message-ID: <appag01q2r79j36spqa19qm0qblgjg9v46@4ax.com>
On 26 Jul 2004 12:59:29 -0700, "Jeff" <···@insightbb.com> wrote:

>I'm having a difficult time understanding why the following does not
>work as expected:
>
>(setf test (make-hash-table :test #'equalp))
>==> <#HashTable>
>
>(setf (gethash "one" test) 1)
>==> 1
>
>(gethash "ONE" test)
>==> NIL NIL
>(equalp "one" "ONE") 
>==> T
>
>Thanks in advance for any insight :)
 

Your Lisp is broken.

Your example works fine using my Lispworks and Allegro.

What Lisp / version / OS are you using ?
From: Edi Weitz
Subject: Re: EQUALP in a hash table
Date: 
Message-ID: <87acxmv7uz.fsf@bird.agharta.de>
On 26 Jul 2004 12:59:29 -0700, "Jeff" <···@insightbb.com> wrote:

> I'm having a difficult time understanding why the following does not
> work as expected:
>
> (setf test (make-hash-table :test #'equalp))
> ==> <#HashTable>
>
> (setf (gethash "one" test) 1)
> ==> 1
>
> (gethash "ONE" test)
> ==> NIL NIL
> (equalp "one" "ONE") 
> ==> T

You didn't tell us which Lisp implementation you are using but your
first SETF form invokes undefined behaviour unless you've previously
declared TEST with DEFPARAMETER or DEFVAR. Does the following form do
what you expect?

  (let ((test (make-hash-table :test #'equalp)))
    (setf (gethash "one" test) 1)
    (gethash "ONE" test))

Cheers,
Edi.

-- 

"Lisp doesn't look any deader than usual to me."
(David Thornley, reply to a question older than most languages)

Real email: (replace (subseq ·········@agharta.de" 5) "edi")