david135 / ypsilon

Automatically exported from code.google.com/p/ypsilon
Other
0 stars 0 forks source link

hashtable-size doesn't report actual size #115

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Ypsilon 0.9.6-trunk/r503 Copyright (c) 2009 Y.Fujita, LittleWing Company
Limited.
> (define ht (make-hashtable string-hash string=?))
> (hashtable-set! ht "a" 1)
> (hashtable-size ht)
1
> (hashtable-set! ht "b" 2)
> (hashtable-set! ht "c" 3)
> (hashtable-size ht)
3
> (hashtable-delete! ht "b")
> (hashtable-size ht)
3
> (vector-length (hashtable-keys ht))
2

Note the difference between the results of the last two lines. I think
this is inconsistent with the wording from R6RS:

,----
| (hashtable-size hashtable)    procedure 
| 
| Returns the number of keys contained in hashtable as an exact integer
| object.
`----

Regards, Rotty

Original issue reported on code.google.com by rott...@gmail.com on 29 Jul 2009 at 11:28