assoc


(assoc  item  list)

This function searches the (plain or association) list for an entry using item as first element of a list entry, and returns the entry if found or NIL

Arguments

list  list of DottedPair items, or a list of plain list elements

item  the 'key' to be used to find a list entry, which contains item as first element

Return

the list entry using item as key or first list element

Example

DottedPair List :
(setq lst (list (cons 1 "A")(cons 2 "B")))
(assoc 1 lst)
(1 . "A")
(assoc 2 lst)
(2 . "B")

Plain List :
(setq lst (list (list 1 2 "A")(list 2 3 "B")))
(assoc 1 lst)
(1 2 "A")
(assoc 2 lst)
(2 3 "B")

Mixed List :
(setq lst (list (list 1 2 "A")(cons 2 "B")))
(assoc 1 lst)
(1 2 "A")
(assoc 2 lst)
(2 "B")

Remarks

the  can be combined of DottedPair and Plain List entries



©  Bricsys NV. All rights reserved.