User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

====== Function NCONC ====== ====Syntax==== * **nconc** //''&rest'' lists// → //concatenated-list// ====Arguments and Values==== * //list// - each but the last must be a //[[CL:Glossary:list]]// (which might be a //dotted list// but must not be a //[[CL:Glossary:circular list]]//); the last //list// may be any //[[CL:Glossary:object]]//. * //concatenated-list// - a //[[CL:Glossary:list]]//. ====Description==== Returns a //[[CL:Glossary:list]]// that is the concatenation of //lists//. If no //lists// are supplied, ''(nconc)'' returns **[[CL:Constant Variable:nil]]**. **nconc** is defined using the following recursive relationship: <blockquote> ([[CL:Functions:apply]] #'nconc [[CL:Constant Variables:nil]] lists) ≡ ([[CL:Functions:apply]] #'nconc lists) (nconc list-1 list-2) ≡ ([[CL:Special Operators:progn]] ([[CL:Functions:rplacd]] ([[CL:Functions:last]] list-1) list-2) list-1) ([[CL:Functions:apply]] #'nconc list-1 list-2 lists) ≡ ([[CL:Functions:apply]] #'[[CL:Functions:nconc]] ([[CL:Functions:nconc]] list-1 list-2) lists) </blockquote> ====Examples==== <blockquote> (nconc) <r>[[CL:Constant Variable:nil|NIL]]</r> (nconc (list 'foo 'bar 'baz))) <r>(FOO BAR BAZ)</r> ([[CL:Macros:defparameter]] *x* '(a b c)) <r>(A B C)</r> ([[CL:Macros:defparameter]] *y* '(d e f)) <r>(D E F)</r> (nconc *x* *y*) <r>(A B C D E F)</r> *x* <r>(A B C D E F)</r> </blockquote> Note, in the example, that the value of ''*x*'' is now different, since its last //[[CL:Glossary:cons]]// has been **[[CL:Functions:rplacd]]**'d to the value of ''*y*''. If ''(nconc *x* *y*)'' were evaluated again, it would yield a piece of a //[[CL:Glossary:circular list]]//, whose printed representation would be ''(A B C D E F D E F D E F ...)'', repeating forever; if the **[[CL:Variables:*print-circle*]]** switch were //[[CL:Glossary:non-nil]]//, it would be printed as ''(A B C . #1=(D E F . #1#))''. <blockquote> ([[CL:Macros:defparameter]] *foo* ([[CL:Functions:list]] 'a 'b 'c 'd 'e)) <r>*FOO*</r> ([[CL:Macros:defparameter]] *bar* ([[CL:Functions:list]] 'f 'g 'h 'i 'j)) <r>*BAR*</r> ([[CL:Macros:defparameter]] *baz* ([[CL:Functions:list]] 'k 'l 'm)) <r>*BAZ*</r> ([[CL:Macros:setf]] *foo* (nconc *foo* *bar* *baz*)) <r>(A B C D E F G H I J K L M)</r> *foo* <r>(A B C D E F G H I J K L M)</r> *bar* <r>(F G H I J K L M)</r> *baz* <r>(K L M)</r> ([[CL:Macros:setf]] *foo* ([[CL:Functions:list]] 'a 'b 'c 'd 'e) <r>(A B D C E)</r> ([[CL:Macros:setf]] *bar* ([[CL:Functions:list]] 'f 'g 'h 'i 'j)) <r>(F G H I J)</r> ([[CL:Macros:setf]] *baz* ([[CL:Functions:list]] 'k 'l 'm)) <r>(K L M)</r> ([[CL:Macros:setf]] *foo* (nconc [[CL:Constant Variables:nil]] *foo* *bar* [[CL:Constant Variables:nil]] *baz*)) <r>(A B C D E F G H I J K L M) </r> *foo* <r>(A B C D E F G H I J K L M)</r> *bar* <r>(F G H I J K L M)</r> *baz* <r>(K L M)</r> </blockquote> ====Side Effects==== The //lists// are modified rather than copied. ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== **[[CL:Functions:append|Function APPEND]]**, **[[CL:Functions:concatenate|Function CONCATENATE]]** ====Example Implementation==== To be done. ====Notes==== None. \issue{REMF-DESTRUCTION-UNSPECIFIED:X3J13-MAR-89} \issue{DOTTED-LIST-ARGUMENTS:CLARIFY}