[erlang-questions] Proposal: add lists:intersperse/2 and lists:intercalate/2

Chandru chandrashekhar.mullaparthi@REDACTED
Wed Mar 9 11:27:05 CET 2016


On 8 March 2016 at 23:18, Richard A. O'Keefe <ok@REDACTED> wrote:

> On 8/03/16 8:24 pm, Chandru wrote:
>
>> On 7 March 2016 at 16:04, Loïc Hoguin <essen@REDACTED <mailto:
>> essen@REDACTED>> wrote:
>>
>>
>>     I am completely with you on that. If the function was called
>>     intercalculate I'd never find it and would continue writing my own.
>>
>>
>> I second this. I'm part of the vast number of unwashed masses who've
>> never heard of the term intercalculate,
>>
>
> Please, if you are going to pour scorn on a word, at least COPY
> the thing correctly.  The proposal is not "intercalCULate" but
> "intercalate",
> and it's a real English word with a history going back at least 400 years
> in English, 500 years in French, and 2500 years in Latin.
>

Okay, sorry, my mistake.


>
> I think it's a bad name not because nobody knows what it means (I'd expect
> any skilled native speaker of English to have met it several times) but
> because
> it means to insert ONE (unusual) thing into a sequence of (ordinary)
> things,
> as in one leap day or one leap month into a year.


I looked up the definition and while I couldn't find one which restricts
the insertion to ONE thing, it certainly doesn't say it is the repeated
insertion into a sequence, so clearly intercalate is the wrong choice here.


>
> and if I came across it in a developer's code would think that they were
>> being a bit too clever. Like many others I have written this piece of code
>> several times and invariably named it 'concat_with_separator' - a mouthful
>> but it conveys (at least to me) what exactly the function is doing.
>>
> Since 1997 (if not before) the SML Basis Library has included
>
> fun concatWith _ [] = ""
>   | concatWith separator (string :: strings) =
>     concat (string :: map (fn x => separator^x) strings)
>
> (*) I am using that as a specification.  It would be a horrible
> implementation.
>
>
I personally would be happy with concat_with or concat_with_separator.

I find the proposal for the use of 'join' wrong. In plain English, joining
things doesn't usually involve inserting things in between.

regards,
Chandru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160309/b50cb39a/attachment.htm>


More information about the erlang-questions mailing list