Subject: bug#76242: closed (Re: bug#76242: [PATCH] Clarify that mapconcat's FUNCTION can return nil)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 13 Feb 2025 09:06:03 +0000

Your bug report

#76242: [PATCH] Clarify that mapconcat's FUNCTION can return nil

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].

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

Subject: Re: bug#76242: [PATCH] Clarify that mapconcat's FUNCTION can return nil
From: Eli Zaretskii <[email-masked]>
To: Hong Xu <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 13 Feb 2025 11:04:34 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Thu, 13 Feb 2025 00:27:45 -0800
> From: Hong Xu <[email-masked]>
> CC: [email-masked]
> 
> On February 12, 2025 11:57:05 PM PST, Eli Zaretskii <[email-masked]> wrote:
> >> Cc: [email-masked]
> >> Date: Thu, 13 Feb 2025 02:27:52 +0100
> >> From:  Michael Heerdegen via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <[email-masked]>
> >> 
> >> Hong Xu via "Bug reports for GNU Emacs, the Swiss army knife of text
> >> editors" <[email-masked]> writes:
> >> 
> >> > -FUNCTION must be a function of one argument, and must return a value
> >> > -  that is a sequence of characters: either a string, or a vector or
> >> > -  list of numbers that are valid character codepoints.  */)
> >> > + FUNCTION must be a function of one argument, and must return either:
> >> > +
> >> > +   nil, which is treated as an empty string, or
> >> > +   a value that is a sequence of characters, which is either a string,
> >> > +   or a vector or list of numbers that are valid character codepoints. */)
> >> 
> >> I don't understand the rationale.  Isn't nil just one case of an empty
> >> sequence of characters?  Why describe it specially?
> >
> >How about the below instead:
> >
> >  FUNCTION must be a function of one argument, and must return a value
> >    that is a sequence of characters: either a string, or a vector or
> >    list of numbers that are valid character codepoints; nil is treated
> >    as an empty string.
> 
> I agree, this is better.

> From: Stefan Kangas <[email-masked]>
> Date: Thu, 13 Feb 2025 00:29:27 -0800
> Cc: [email-masked], [email-masked]
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > How about the below instead:
> >
> >   FUNCTION must be a function of one argument, and must return a value
> >     that is a sequence of characters: either a string, or a vector or
> >     list of numbers that are valid character codepoints; nil is treated
> >     as an empty string.
> 
> LGTM.

Thanks, installed on the emacs-30 release branch, and closing the bug.

Subject: [PATCH] Clarify that mapconcat's FUNCTION can return nil
From: Hong Xu <[email-masked]>
To: [email-masked]
Cc: Hong Xu <[email-masked]>
Date: Wed, 12 Feb 2025 14:27:03 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

* src/fns.c (Fmapconcat): Explain that FUNCTION can return nil.
---
 src/fns.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/fns.c b/src/fns.c
index bee44b222c5e..f02a1b6838da 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3400,9 +3400,11 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string.
 Optional argument SEPARATOR must be a string, a vector, or a list of
 characters; nil stands for the empty string.
 
-FUNCTION must be a function of one argument, and must return a value
-  that is a sequence of characters: either a string, or a vector or
-  list of numbers that are valid character codepoints.  */)
+ FUNCTION must be a function of one argument, and must return either:
+
+   nil, which is treated as an empty string, or
+   a value that is a sequence of characters, which is either a string,
+   or a vector or list of numbers that are valid character codepoints. */)
   (Lisp_Object function, Lisp_Object sequence, Lisp_Object separator)
 {
   USE_SAFE_ALLOCA;
-- 
2.48.1