elisp: Hash Access

 
 7.2 Hash Table Access
 =====================
 
 This section describes the functions for accessing and storing
 associations in a hash table.  In general, any Lisp object can be used
 as a hash key, unless the comparison method imposes limits.  Any Lisp
 object can also be used as the value.
 
  -- 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.
 
  -- Function: puthash key value table
      This function enters an association for KEY in TABLE, with value
      VALUE.  If KEY already has an association in TABLE, VALUE replaces
      the old associated value.
 
  -- Function: remhash key table
      This function removes the association for KEY from TABLE, if there
      is one.  If KEY has no association, ‘remhash’ does nothing.
 
      Common Lisp note: In Common Lisp, ‘remhash’ returns non-‘nil’ if it
      actually removed an association and ‘nil’ otherwise.  In Emacs
      Lisp, ‘remhash’ always returns ‘nil’.
 
  -- Function: clrhash table
      This function removes all the associations from hash table TABLE,
      so that it becomes empty.  This is also called “clearing” the hash
      table.
 
      Common Lisp note: In Common Lisp, ‘clrhash’ returns the empty
      TABLE.  In Emacs Lisp, it returns ‘nil’.
 
  -- Function: maphash function table
      This function calls FUNCTION once for each of the associations in
      TABLE.  The function FUNCTION should accept two arguments—a KEY
      listed in TABLE, and its associated VALUE.  ‘maphash’ returns
      ‘nil’.