Function: assq

assq is a function defined in fns.c.

Signature

(assq KEY ALIST)

Documentation

Return non-nil if KEY is eq to the car of an element of ALIST.

The value is actually the first element of ALIST whose car is KEY. Elements of ALIST that are not conses are ignored.

Other relevant functions are documented in the list and alist groups.

View in manual

Probably introduced at or before Emacs version 17.

Shortdoc

;; alist
(assq 'foo '((foo . bar) (zot . baz)))
    => (foo . bar)
;; list
(assq 'b '((a . 1) (b . 2)))
    => (b . 2)

Aliases

gnus-data-find-in

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  Lisp_Object tail = alist;
  FOR_EACH_TAIL (tail)
    if (CONSP (XCAR (tail)) && EQ (XCAR (XCAR (tail)), key))
      return XCAR (tail);
  CHECK_LIST_END (tail, alist);
  return Qnil;
}