Function: maphash

maphash is a function defined in fns.c.

Signature

(maphash FUNCTION TABLE)

Documentation

Call FUNCTION for all entries in hash table TABLE.

FUNCTION is called with two arguments, KEY and VALUE. It should not alter TABLE in any way other than using puthash to set a new value for KEY, or remhash to remove KEY. maphash always returns nil.

Other relevant functions are documented in the hash-table group.

View in manual

Probably introduced at or before Emacs version 21.1.

Shortdoc

;; hash-table
(maphash (lambda (key value) (message value)) table)
    => nil

Aliases

cl-maphash (obsolete since 24.3)

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  struct Lisp_Hash_Table *h = check_hash_table (table);
  /* We can't use DOHASH here since FUNCTION may violate the rules and
     we shouldn't crash as a result (although the effects are
     unpredictable).  */
  DOHASH_SAFE (h, i)
    calln (function, HASH_KEY (h, i), HASH_VALUE (h, i));
  return Qnil;
}