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

Robert Wilkinson <>
Wed Mar 2 16:05:23 CET 2016


On Wed, Mar 02, 2016 at 03:47:41PM +0100, Jesper Louis Andersen wrote:
> Hi Erlangers,
> 
> I'd really like to add two functions to the lists module from Haskell:
> 
> intersperse(List, Seperator) produces a list where each element is
> separated by separator, i.e.
> 
> X = [1,2,3]
> [1, x, 2, x, 3] = lists:intersperse(X, x),
> 
> and it's cousin, intercalate(ListOfLists, Separator) is
> append(intersperse(ListOfLists, Seperator)), i.e,
> 
> Thoughts?
> 
> -- 
> J.

Hi Jesper

Please spell Separator consistently and correctly :-)

Bob
-- 
Kiss me, Kate, we will be married o' Sunday.
		-- William Shakespeare, "The Taming of the Shrew"



More information about the erlang-questions mailing list