summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 461b1664..ba129115 100644
--- a/lib.c
+++ b/lib.c
@@ -8175,6 +8175,21 @@ val copy_cons(val cell)
}
}
+val copy_tree(val tree)
+{
+ if (atom(tree)) {
+ return tree;
+ } else {
+ val car = copy_tree(tree->c.car);
+ val cdr = copy_tree(tree->c.cdr);
+ val copy = make_obj();
+ *copy = *tree;
+ copy->c.car = car;
+ copy->c.cdr = cdr;
+ return copy;
+ }
+}
+
val copy_alist(val list)
{
list_collect_decl (out, ptail);