Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

nconc

nconc

type: function (subr) 
location: built-in
source file: xllist.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

(nconc [ <list1> ... ] )
        <listN>         -       a list to DESTRUCTIVELY concatenate

DESCRIPTION

NCONC destructively concatenates a sequence of lists and returns the result of this concatentation. The destructive aspect of this operation means that the actual symbol values are used in the list-modifying operations - not copies. This means, for NCONC, that the lists are spliced together. <listN> must evaluate to a valid list. An atom for <listN> will result in an error. NIL is a valid <listN>.

EXAMPLES

(setq a '(1 2 3))                       ; set up A with (1 2 3)
(setq b '(4 5 6))                       ; set up B with (4 5 6)
(setq c '(7 8 9))                       ; set up C with (7 8 9)
(NCONC a b c)                           ; returns (1 2 3 4 5 6 7 8 9)
(setf (nth 8 a) 'end)                   ; change last element of A
(print a)                               ; prints (1 2 3 4 5 6 7 8 END)
(print b)                               ; prints (4 5 6 7 8 END)
(print c)                               ; prints (7 8 END)


Go to the first, previous, next, last section, table of contents.