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

nconc

nconc( 
l_arg1 
l_arg2 
[ l_arg3 ... ] 
) 
=> l_result

Description

Equivalent to a destructive append where the first argument is modified.

This results in nconc being much faster than append but not as fast as tconc and lconc. Thus nconc returns a list consisting of the elements of l_arg1, followed by the elements of l_arg2, followed by the elements of l_arg3, and so on. The cdr of the last list cell of l_argi is modified to point to l_argi+1. Thus caution must be taken because if nconc is called with the l_argi two consecutive times it can form an infinite structure where the cdr of the last list cell of l_argi points to the car of l_argi.

Use the nconc function principally to reduce the amount of memory consumed. A call to append would normally duplicate the first argument whereas nconc does not duplicate any of its arguments, thereby reducing memory consumption.

Arguments

l_arg1

List of elements.

l_arg2

List elements concatenated to l_arg1.

l_arg3

Additional lists.

Value Returned

l_result

The modified value of l_arg1.

Examples

The following example forms an infinite list structure (a b c d e f g a b c d e f g ...).

x = '(a b c) 
nconc( x '(d)) ; x is now (a b c d)
nconc( x '(e f g) ) ; x is now the list (a b c d e f g)
nconc( x x )   ; Forms an infinite structure.

Related Topics

lconc

tconc


Return to top
 ⠀
X