From 037e9a2b91f982fc941af8a152b4b104e418755b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 6 Oct 2015 06:20:55 -0700 Subject: Allow conses functions to work on vecs and strings. * lib.c (conses): Use consp termination test only if input is a list. --- lib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index 25299bc7..20fb605e 100644 --- a/lib.c +++ b/lib.c @@ -475,8 +475,12 @@ val conses(val list) { list_collect_decl (out, ptail); - for (; consp(list); list = cdr(list)) - ptail = list_collect(ptail, list); + if (listp(list)) + for (; consp(list); list = cdr(list)) + ptail = list_collect(ptail, list); + else + for (; list; list = cdr(list)) + ptail = list_collect(ptail, list); return out; } -- cgit v1.2.3