GNU bug report logs -
#36418
26.2.90; mapconcat "SEPARATOR must be a string." is incorrect
Previous Next
Reported by: Xu Chunyang <mail <at> xuchunyang.me>
Date: Fri, 28 Jun 2019 13:24:02 UTC
Severity: minor
Found in version 26.2.90
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Xu Chunyang <mail <at> 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
This bug report was last modified 5 years and 323 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.