all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Xu Chunyang <mail@xuchunyang.me>
Cc: 36418@debbugs.gnu.org
Subject: bug#36418: 26.2.90; mapconcat "SEPARATOR must be a string." is incorrect
Date: Sat, 6 Jul 2019 06:17:08 +0200	[thread overview]
Message-ID: <CADwFkm=gLT69f0LSWH8OdfGPZsSC5TNRNTSp5EbTv7g9LJizyw@mail.gmail.com> (raw)
In-Reply-To: <m2woh5etdf.fsf@xuchunyang.me>

Xu Chunyang <mail@xuchunyang.me> writes:

> C-h f mapconcat says
>
>> SEPARATOR must be a string.
>
> but nil works fine
>
>     (mapconcat #'identity '("a" "b") nil)
>     ;; => "ab"

This seems to have been added in commit aecbbd57, which fixes
Bug#35710:

   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35710

Perhaps Eli would want to weigh in on this?

> and `string-join` relies on this fact (by the way, string-join's
> docstring doesn't explain the case when separator is omitted or nil)
>
>     (defsubst string-join (strings &optional separator)
>       "Join all STRINGS using SEPARATOR."
>       (mapconcat 'identity strings separator))

This could be expanded, in my opinion.

> C-h S mapconcat says
>
>> SEPARATOR, which also must be a string, or a vector or list of
>> characters.
>
> C-h f concat says
>
>> Each argument may be a string or a list or vector of characters (integers).

In other words, since SEPARATOR can be a "list of characters", it
follows that it can also be nil (which is equivalent to the empty list).

Thanks,
Stefan Kangas





  reply	other threads:[~2019-07-06  4:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 13:23 bug#36418: 26.2.90; mapconcat "SEPARATOR must be a string." is incorrect Xu Chunyang
2019-07-06  4:17 ` Stefan Kangas [this message]
2019-07-06  7:32   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADwFkm=gLT69f0LSWH8OdfGPZsSC5TNRNTSp5EbTv7g9LJizyw@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=36418@debbugs.gnu.org \
    --cc=mail@xuchunyang.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.