Subject: bug#76472: closed (Re: bug#76472: nconc should fail for dotted lists)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 21 Feb 2025 18:04:03 +0000

Your bug report

#76472: nconc should fail for dotted lists

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76472: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76472
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#76472: nconc should fail for dotted lists
From: Pip Cet <[email-masked]>
To: Mattias Engdegård <[email-masked]>
Cc: [email-masked]
Date: Fri, 21 Feb 2025 18:03:19 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Mattias Engdegård <[email-masked]> writes:

>> The current behavior is: (nconc '(1 . 2) '(3 4)) => (1 3 4)
>
> Actually that is probably intended and completely fine. It's what
> Common Lisp defines for this operation, and I don't think adding a nil
> check would be an improvement.

Sorry for the noise, closing.

Pip

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.