From 5d0eb90d21bf830fdfc91337b4b3975a64a406f7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 16 Oct 2019 08:16:04 -0700 Subject: copy-alist: no mapcar. * lib.c (copy_alist): Rewrite using list_collect iteration. endp is used for detecting improper list. --- lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index aa5fcde8..461b1664 100644 --- a/lib.c +++ b/lib.c @@ -8177,7 +8177,10 @@ val copy_cons(val cell) val copy_alist(val list) { - return mapcar(func_n1(copy_cons), list); + list_collect_decl (out, ptail); + for (; !endp(list); list = cdr(list)) + ptail = list_collect(ptail, copy_cons(car(list))); + return out; } val mapcar_listout(val fun, val seq) -- cgit v1.2.3