I'm having trouble getting my hash table to reliably return values and I wonder whether someone might be able to advise?
Here's what I'm doing:
- Make table:
(setq table (make-hash-table))
- Define a variable for naming elements in the table, initial name is "bob" but in my program this will hold a user generated value, which will change from time to time:
(defvar name-of-element "bob")
- Add a row to the table, named after the contents of
name-of-element
:
(setf (gethash name-of-element table) "bob's element")
- When I retrieve the element from the table using the key
name-of-element
:
(gethash name-of-element table)
I get:
"bob's element"
T
- But when I try to retrieve using
"bob"
:
(gethash "bob" table)
I get negative/no result:
N
N
Thoughts?