assoc (AutoLISP)

 
 
 

Searches an association list for an element and returns that association list entry

Supported Platforms: Windows and Mac OS

Signature

(assoc element alist)
element

Type: Integer, Real, or String

Key of an element in an association list.

alist

Type: List

An association list to be searched.

Return Values

Type: List or nil

The alist entry, if successful. If assoc does not find element as a key in alist, it returns nil.

Examples

(setq al '((name box) (width 3) (size 4.7263) (depth 5)))
((NAME BOX) (WIDTH 3) (SIZE 4.7263) (DEPTH 5))

(assoc 'size al)
(SIZE 4.7263)

(assoc 'weight al)
nil