Subject: nconc should fail for dotted lists
From: Pip Cet <[email-masked]>
To: [email-masked]
Date: Fri, 21 Feb 2025 14:14:44 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

The current behavior is:

(nconc '(1 . 2) '(3 4)) => (1 3 4)

This doesn't seem to me to match the documentation, because the cdr of
the first argument, 2, is discarded.  'append' signals in the equivalent
situation, and I think nconc should, too:

From 285a30392273552503fa6d66bf7a9bdb472f6a8e Mon Sep 17 00:00:00 2001
From: Pip Cet <[email-masked]>
Subject: [PATCH] Make 'nconc' signal an error for dotted lists (bug#)

* src/fns.c (Fnconc): Call 'CHECK_LIST_END' for all but the last
element.
---
 src/fns.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/fns.c b/src/fns.c
index 0ba8e42a60f..720ddb666ca 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3354,6 +3354,7 @@ DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0,
       Lisp_Object tail UNINIT;
       FOR_EACH_TAIL (tem)
 	tail = tem;
+      CHECK_LIST_END (tem, args[argnum]);
 
       tem = args[argnum + 1];
       Fsetcdr (tail, tem);
-- 
2.48.1

No indication in the git log that this behavior is intentional.