Experienced lisp, scheme, clojure programmer making the move to elisp from python for automating routine, everyday, basic tasks: I got an enormous surprise from the following in
ELISP> (setq h2 (make-hash-table)) #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8 data ()) ELISP> (puthash "a" 1 h2) 1 (#o1, #x1, ?\C-a) ELISP> (gethash "a" h2) nil
huh? The key and the value appear to be present:
ELISP> h2 #s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8 data ("a" 1))
/slaps forehead. I must be missing something totally obvious. Info says:
-- Function: gethash key table &optional default This function looks up KEY in TABLE, and returns its associated VALUE—or DEFAULT, if KEY has no association in TABLE.
great. Let's see if we can get
gethash to return anything other than
ELISP> (gethash "a" h2 'fubar) fubar
wow. Ok, I'm a lot dumber than I thought. What on earth am I doing wrong?