From: Tino Calancha <tino.calancha@gmail.com>
To: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: concat with separators ?
Date: Sun, 28 May 2017 20:27:05 +0900 (JST) [thread overview]
Message-ID: <alpine.DEB.2.20.1705282014340.2520@calancha-pc> (raw)
In-Reply-To: <851096D1-69F3-4904-B2FC-112877D80586@gmail.com>
On Sun, 28 May 2017, Jean-Christophe Helary wrote:
>
>> On May 28, 2017, at 19:52, Tino Calancha <tino.calancha@gmail.com> wrote:
>>
>>>>> That's roughly the definition of string-join in subr-x:
>>>>>
>>>>> (defsubst string-join (strings &optional separator)
>>>>> "Join all STRINGS using SEPARATOR."
>>>>> (mapconcat 'identity strings separator))
>>>
>>> Would it be acceptable to provide separators to concat or is it preferable to use string-join instead?
>
>> The latter.
>> Func. `concat' accepts any arbitrary number of sequences (not a list of
>> sequences as `string-join').
>
> I know that, but subr-x is experimental (hence not documented in the manual) and having to use mapconcat just to add a separator seems not practical.
I wouldn't worry too much about `string-join' not being in the manual.
It's going to keep there. If it's convenient for you feel free to use it.
Many people here like to use stuff from subr-x.el.
Or you can create in your package a `foo-string-join' (foo being your
package prefix). Once you write your package manual, this function will
be documented in the Emacs manual as well.
We cannot modify `concat' with a new argument `separator' without breaking
existent code.
You can pass the separator between strings:
(concat "foo" ":" "bar" ":" "qux")
=> "foo:bar:qux"
Or use format:
(format "%s:%s:%s" "foo" "bar" "qux")
=> "foo:bar:qux"
prev parent reply other threads:[~2017-05-28 11:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 14:18 concat with separators ? Jean-Christophe Helary
2017-05-24 14:21 ` Kaushal Modi
2017-05-24 14:34 ` Clément Pit-Claudel
2017-05-28 5:33 ` Jean-Christophe Helary
2017-05-28 10:52 ` Tino Calancha
2017-05-28 11:02 ` Jean-Christophe Helary
2017-05-28 11:27 ` Tino Calancha [this message]
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=alpine.DEB.2.20.1705282014340.2520@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=jean.christophe.helary@gmail.com \
/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.