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
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.
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 ?
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")