From 66b7424d8d57bcfb5b5f2b2cfae5fc1462278ef7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 22 Nov 2017 06:47:32 -0800 Subject: bugfix: tail handles improper list. * lib.c (tail): This low-level function is used by the list accumulation routines. Because it doesn't handle improper lists, looking for a null terminator, certain things don't work, like the associativity of append. For instance (append '(1 2) #(3) 4) works but not (append (append '(1 2) #(3)) 4). Fixing tail so that it terminates on any atom, rather than failing trying to cdr through it. --- lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.c b/lib.c index 97d0eece..08deb233 100644 --- a/lib.c +++ b/lib.c @@ -615,7 +615,7 @@ loc listref_l(val list, val ind) loc tail(val cons) { - while (cdr(cons)) + while (consp(cdr(cons))) cons = cdr(cons); return cdr_l(cons); } -- cgit v1.2.3