bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hash-table


From: Pach Roman (GS/EEP3) *
Subject: hash-table
Date: Mon, 21 Jan 2002 10:39:35 +0100

Hello,
I'm just testing the emacs hash implementation (GNU Emacs 21.1.1
(i386-mingw-nt4.0.1381)).
The following piece of code does not function correctly:

(progn 
  (setq dump-buffer (get-buffer "*scratch*"))

  (defun print-key-value (key value)
        (princ (format "(key,val) = ('%s' '%s')\n" key value) dump-buffer)
        )

  (defun case-fold-string= (a b)
        (compare-strings a nil nil b nil nil t))
  
  (defun case-fold-string-hash (a)
        (sxhash (upcase a)))
     
  (define-hash-table-test 
        'case-fold 
        'case-fold-string=
        'case-fold-string-hash)
  
  (setq x (make-hash-table :test 'case-fold))
  (puthash "key-18" "value-18" x)
  (puthash "key-20" "value-20" x)
  
  (maphash 'print-key-value x))

And here is the result in *scratch* buffer:
    (key,val) = ('key-18' 'value-20')

I'd rather be expecting: 
    ('key-18' 'value-18')
    ('key-20' 'value-20')

Bye,
Roman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]