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

nth

nth( 
x_index0 
l_list 
) 
=> g_result / nil

Description

Returns an index-selected element of a list, assuming a zero-based index.

Thus, nth(0 l_list) is the same as car(l_list). The value nil is returned if x_index0 is negative or is greater than or equal to the length of the list.

Arguments

x_index0

Index of the list element you want to be returned.

l_list

List of elements.

Value Returned

g_result

Indexed element of l_list, assuming a zero-based index

nil

If x_index0 is negative or is greater than or equal to the length of the list.

Examples

nth( 1 '(a b c) )    
=> b
z = '(1 2 3)         
=> (1 2 3)
nth(2 z)             
=> 3
nth(3 z)             
=> nil

Related Topics

list

nthcdr

nthelem


Return to top
 ⠀
X