Defining a Hash Table

> (setf foods (make-hash-table)) To retrieve a value, use the gethash function. Of course, before we can retrieve a value, we need to store the value using a key. The gethash function is also used to access the location in the hash table for storing.

Storing Values

Here we store the value "fruit" with the key "apple". (setf (gethash 'apple foods) 'fruit)

Retrieving Values

Here we retrieve the value for the key "apple".

> (gethash 'apple foods) FRUIT ; T