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

Richard A. O'Keefe <>
Thu Mar 3 05:31:58 CET 2016

On 3/03/16 2:23 pm, Siraaj Khandkar wrote:
>> interleave, v, OED, sense 3:
>> "Computing and Telecommunications. To interfile (two or more
>> digitized signals or sequences of information) by alternating
>> between them; to alternate (one such signal or sequence) with
>> others. Also, to divide (memory, etc.) between a number of
>> different tasks by allocating successive segments to each in turn."
>> (I must admit I hadn't encountered the word 'interfile' before.)
> The way I understand it is:
> - interleave: put 1 B between 2 As
[A1,B1,A2,B2,A3,B3] will do.
[A1,B1,A2,B2,A3,B3,A4] will do.
Using the *same* B every time is not interleaving.

A simple example of interleaving: put the fingers of one hand between
the fingers of the other.

Please people, do NOT use the word "interleaving" to refer to what
the proposed "intersperse" function does.  We need "interleaving"
to refer to interleaving.
> - intersperse: put M Bs between N As
OED sense 1: "to scatter or sprinkle between or among other things;
to place here and there in the course of something; to mingle
dispersedly or at intervals."

I don't think anyone looking at the OED would expect the Haskell
function definition.  The only justification for adopting the names
intersperse and intercalate is that those *are* the names other
not-entirely-dissimilar programming languages are using.

More information about the erlang-questions mailing list