GNU bug report logs - #76472
nconc should fail for dotted lists

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> protonmail.com>

Date: Fri, 21 Feb 2025 14:16:02 UTC

Severity: normal

Done: Pip Cet <pipcet <at> protonmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Pip Cet <pipcet <at> protonmail.com>
To: 76472 <at> debbugs.gnu.org
Subject: bug#76472: nconc should fail for dotted lists
Date: Fri, 21 Feb 2025 14:14:44 +0000
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 <pipcet <at> protonmail.com>
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.





This bug report was last modified 140 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.