cadr (AutoLISP)

 
 
 

Returns the second element of a list

Supported Platforms: Windows and Mac OS

Signature

(cadr list)
list

Type: List

A list with two or more elements.

Return Values

Type: Integer, Real, String, List, T or nil

The second element in list; otherwise nil, if the list is empty or contains only one element.

Remarks

In AutoLISP, cadr is frequently used to obtain the Y coordinate of a 2D or 3D point (the second element of a list of two or three reals).

Examples

(setq pt2 '(5.25 1.0))
(5.25 1.0)

(cadr pt2)
1.0

(cadr '(4.0))
nil

(cadr '(5.25 1.0 3.0))
1.0