From: Haiwei
Subject: a list as key in the hash table
Date: 
Message-ID: <76824136-3df7-432f-acba-d96b653cac43@b9g2000prh.googlegroups.com>
Hi,

I wonder how  the hash table computes the hash code when the key is a
list.
it seems not to use the content to compute hash code, but use the
pointer of cons. I am confused.

Regards,
Haiwei

* (setq a (make-hash-table))

Warning:  Declaring A special.

#<EQL hash table, 0 entries {5819D7CD}>
* (gethash '(a b c) a)

NIL
NIL
* (eq (gethash '(a b c) a) (gethash '(a b c) a))

T
* (setf (gethash '(a b c) a) 1)

1
* (setf (gethash '(a b c) a) 2)

2
* :i a

:I
*
#<EQL hash table, 2 entries {5819D7CD}>
* (setf (gethash '(a b c) a) 2)

2
* :i a

:I
*
#<EQL hash table, 3 entries {5819D7CD}>

From: Marco Antoniotti
Subject: Re: a list as key in the hash table
Date: 
Message-ID: <4aac19ac-fc1f-4696-a725-3c1d0e05939e@t54g2000hsg.googlegroups.com>
Haiwei wrote:
> Hi,
>
> I wonder how  the hash table computes the hash code when the key is a
> list.
> it seems not to use the content to compute hash code, but use the
> pointer of cons. I am confused.
>
> Regards,
> Haiwei
>
> * (setq a (make-hash-table))

(setf a (make-hash-table :test 'equal)


>
> Warning:  Declaring A special.
>
> #<EQL hash table, 0 entries {5819D7CD}>
> * (gethash '(a b c) a)
>
> NIL
> NIL
> * (eq (gethash '(a b c) a) (gethash '(a b c) a))
>
> T
> * (setf (gethash '(a b c) a) 1)
>
> 1
> * (setf (gethash '(a b c) a) 2)
>
> 2
> * :i a
>
> :I
> *
> #<EQL hash table, 2 entries {5819D7CD}>
> * (setf (gethash '(a b c) a) 2)
>
> 2
> * :i a
>
> :I
> *
> #<EQL hash table, 3 entries {5819D7CD}>
From: Alex Mizrahi
Subject: Re: a list as key in the hash table
Date: 
Message-ID: <4832dcd9$0$90265$14726298@news.sunsite.dk>
 H> I wonder how  the hash table computes the hash code when the key is a
 H> list.
 H> it seems not to use the content to compute hash code, but use the
 H> pointer of cons. I am confused.

 H> #<EQL hash table, 0 entries {5819D7CD}>

(EQL'(a b c) '(a b c)) => NIL