Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

caar, caaar, caadr, cadr, caddr, cdar, cddr, ...

ca|d[ a | d ][ a | d ][ a | d ] r( 
l_list 
) 
=> g_result

Description

Performs operations on a list using repeated applications of car and cdr. For example, caaar is equivalent to car( car( car( l_list))). The possible combinations are caaaar, caaadr, caadar, caaddr, caar, caddar, cadddr, cadr, cdaaar, cdaadr, cdaar, cdadar, cdaddr, cdadr, cdar, cddaar, cddadr, cddar, cdddar, cddddr, cdddr, cddr, caaar, caadr, cadar, caddr, cdadr, cadaar, cadadr, caddar, cadddr, cdaaar, cdaadr, cdadar, cdaddr, cddaar, cddadr, cdddar, and cddddr.

The cadr(l_list) expression, for example, applies cdr to get the tail of the list and then applies car to get the first element of the tail, in effect extracting the second element from the list. SKILL implements all c...r functions with any combination of a and d up to four characters.

Arguments

l_list

List of elements.

Value Returned

g_result

The value of the specified operation.

Examples

caaar is equivalent to car( car( car( l_list))).

caaar('(((1 2 3)(4 5 6))(7 8 9))) 
=> 1

Equivalent to car( car( cdr( l_list))).

caadr('(((1 2 3)(4 5 6))(7 8 9))) 
=> 7

Equivalent to car( car( l_list)).

caar('(((1 2 3)(4 5 6))(7 8 9))) 
=> (1 2 3)

Equivalent to car( cdr( l_list)).

z = '(1 2 3)     
=> (1 2 3)
cadr(z)  
=> 2

Related Topics

car

cdr


Return to top
 ⠀
X