User Tools

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

====== Function COPY-TREE ====== ====Syntax==== * **copy-tree** //tree// → //new-tree// ====Arguments and Values==== * //tree// - a //[[CL:Glossary:tree]]//. * //new-tree// - a //[[CL:Glossary:tree]]//. ====Description==== Creates a //[[CL:Glossary:copy]]// of a //[[CL:Glossary:tree]]// of //[[CL:Glossary:cons|conses]]//. If //tree// is not a //[[CL:Glossary:cons]]//, it is returned; otherwise, the result is a new //[[CL:Glossary:cons]]// of the results of calling **copy-tree** on the //[[CL:Glossary:car]]// and //[[CL:Glossary:cdr]]// of //tree//. In other words, all //[[CL:Glossary:cons|conses]]// in the //[[CL:Glossary:tree]]// represented by //tree// are copied recursively, stopping only when non-//[[CL:Glossary:cons|conses]]// are encountered. **copy-tree** does not preserve circularities and the sharing of substructure. ====Examples==== <blockquote> ([[CL:Macros:defparameter]] *object* ([[CL:Functions:list]] ([[CL:Functions:cons]] 1 "one") ([[CL:Functions:cons]] 2 ([[CL:Functions:list]] 'a 'b 'c)) <r>*OBJECT*</r> ([[CL:Macros:defparameter]] *object-too* *object*) <r>*OBJECT-TOO*</r> ([[CL:Macros:defparameter]] *copy-as-list* ([[CL:Functions:copy-list]] *object*)) <r>*COPY-AS-LIST*</r> ([[CL:Macros:defparameter]] *copy-as-alist* ([[CL:Functions:copy-alist]] *object*)) <r>*COPY-AS-ALIST*</r> ([[CL:Macros:defparameter]] *copy-as-tree* (copy-tree *object*)) <r>*COPY-AS-TREE*</r> ([[CL:Functions:eq]] *object* *object-too*) <r>//[[CL:Glossary:true]]//</r> ([[CL:Functions:eq]] *copy-as-tree* *object*) <r>//[[CL:Glossary:false]]//</r> ([[CL:Functions:eql]] *copy-as-tree* *object*) <r>//[[CL:Glossary:false]]//</r> ([[CL:Functions:equal]] *copy-as-tree* *object*) <r>//[[CL:Glossary:true]]//</r> ([[Cl:Macros:setf]] ([[CL:Functions:first]] ([[CL:Functions:cdr]] ([[CL:Functions:second]] *object*))) "a" ([[CL:Functions:car]] ([[CL:Functions:second]] *object*)) "two" ([[CL:Functions:car]] *object*) '(one . 1)) <r>(ONE . 1)</r> *object* <r>((ONE . 1) ("two" "a" B C))</r> *object-too* <r>((ONE . 1) ("two" "a" B C))</r> *copy-as-list* <r>((1 . "one") ("two" "a" B C))</r> *copy-as-alist* <r>((1 . "one") (2 "a" B C))</r> *copy-as-tree* <r>((1 . "one") (2 A B C))</r> </blockquote> ====Side Effects==== None. ====Affected By==== None. ====Exceptional Situations==== None. ====See also==== **[[CL:Functions:tree-equal|Function TREE-EQUAL]]** ====Example Implementation==== To be done. ====Notes==== None.