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

tconc

tconc( 
l_ptr 
g_x 
) 
=> l_result

Description

Creates a list cell whose car points to a list of the elements being constructed and whose cdr points to the last list cell of the list being constructed.

A tconc structure is a special type of list that allows efficient addition of objects to the end of a list. It consists of a list cell whose car points to a list of the elements being constructed with tconc and whose cdr points to the last list cell of the list being constructed. If l_ptr is nil, a new tconc structure is automatically created. To obtain the list under construction, take the car of the tconc structure.

tconc and lconc are much faster than append when adding new elements to the end of a list. The append function is much slower, because it traverses and copies the list to reach the end, whereas tconc and lconc only manipulate pointers.

Arguments

l_ptr

A tconc structure. Must be initialized to nil to create a new tconc structure.

g_x

Element to add to the end of the list.

Value Returned

l_result

Returns l_ptr, which must be a tconc structure or nil, with g_x added to the end.

Examples

x = tconc(nil 1)        ; x is now ((1) 1)
tconc(x 2) ; x is now ((1 2) 2)
tconc(x 3) ; x is now ((1 2 3) 3)
x = car(x)   ; x is now (1 2 3)

x now equals (1 2 3), the desired result.

Related Topics

lconc


Return to top
 ⠀
X