all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ishi soichi <soichi777@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: error "Odd number of elements in hashtable data
Date: Thu, 12 Jan 2012 11:50:34 +0900	[thread overview]
Message-ID: <CAEjRLuT0U1EdbkDrjSwXkLMY+Py2daaFvD-D5_SrSPX02XomAg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1858 bytes --]

             reply	other threads:[~2012-01-12  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12  2:50 ishi soichi [this message]
2012-01-12  8:55 ` error "Odd number of elements in hashtable data Valentin Baciu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEjRLuT0U1EdbkDrjSwXkLMY+Py2daaFvD-D5_SrSPX02XomAg@mail.gmail.com \
    --to=soichi777@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.