assoc

AutoCad AutoLISP Functions

 
assoc
 
 
 

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

(assoc element alist)

Arguments

element

Key of an element in an association list.

alist

An association list to be searched.

Return Values

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

Examples

Command: (setq al '((name box) (width 3) (size 4.7263) (depth 5)))

((NAME BOX) (WIDTH 3) (SIZE 4.7263) (DEPTH 5))

Command: (assoc 'size al)

(SIZE 4.7263)

Command: (assoc 'weight al)

nil