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. 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);

  for (ptrdiff_t i = 0; i < HASH_TABLE_SIZE (h); ++i)
    {
      Lisp_Object k = HASH_KEY (h, i);
      if (!BASE_EQ (k, Qunbound))
        call2 (function, k, HASH_VALUE (h, i));
    }

  return Qnil;
}