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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pip Cet <pipcet <at> protonmail.com>
Subject: bug#76472: closed (Re: bug#76472: nconc should fail for dotted lists)
Date: Fri, 21 Feb 2025 18:04:03 +0000
[Message part 1 (text/plain, inline)]
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 76472 <at> debbugs.gnu.org.

-- 
76472: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76472
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Pip Cet <pipcet <at> protonmail.com>
To: Mattias Engdegård <mattias.engdegard <at> gmail.com>
Cc: 76472-done <at> debbugs.gnu.org
Subject: Re: bug#76472: nconc should fail for dotted lists
Date: Fri, 21 Feb 2025 18:03:19 +0000
Mattias Engdegård <mattias.engdegard <at> gmail.com> 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


[Message part 3 (message/rfc822, inline)]
From: Pip Cet <pipcet <at> protonmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 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 146 days ago.

Previous Next


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