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

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

error "Odd number of elements in hashtable data


From: ishi soichi
Subject: error "Odd number of elements in hashtable data
Date: Thu, 12 Jan 2012 11:50:34 +0900

I'm trying to develop a database using hash-table.
As you can see, creating a file that contains the data of hash-table.

(setq data-directory "~/(path)/hashtest")
(with-current-buffer (find-file-noselect data-directory)
  (let ((h (make-hash-table :test 'equal)))
    (puthash "think" "hard" h)
    (puthash "go" "this" h)
    (puthash "come" "that" h)
    (puthash "went" "gone" h)
    (puthash "category" "bad" h)
    (puthash "why" "how" h)
    (puthash "what" "on" h)
    (insert (format "%S" h))
    (save-buffer)))

in the "hashtest" file, 

#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("think" "hard" "go" "this" "come" "that" "went" "gone" "category" "bad" "why" "how" "what" "on" ...))

But for checking,

(with-current-buffer
    (find-file-noselect data-directory)
  (let ((ht (read (current-buffer))))
    (gethash "go" ht)))

gives an error, 

Debugger entered--Lisp error: (error "Odd number of elements in hashtable data")...

"Odd number" does not make sense to me at all.
Could anyone help me out?

Thanks in advance!

soichi

reply via email to

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