From c660e30a7dd781f71bed050b20c3e2d0b069e063 Mon Sep 17 00:00:00 2001 From: Jesper Louis Andersen Date: Sat, 9 Apr 2016 17:17:59 +0200 Subject: Implement lists:join/2 Add a call which works much like string:join/2 but for arbitrary lists. Provide the function itself, lifted from Haskells Data.List standard library, provide documentation and provide tests for the function. --- lib/stdlib/doc/src/lists.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/lists.xml b/lib/stdlib/doc/src/lists.xml index 89ba5238b5..84e9615e4f 100644 --- a/lib/stdlib/doc/src/lists.xml +++ b/lib/stdlib/doc/src/lists.xml @@ -261,6 +261,21 @@ flatmap(Fun, List1) -> preferred to foldr/3.

+ + + Insert an element between elements in a list + +

Inserts Sep between each element in List1. Has no + effect on the empty list and on a singleton list. For example:

+
+> lists:join(x, [a,b,c]).
+[a,x,b,x,c]
+> lists:join(x, [a]).
+[a]
+> lists:join(x, []).
+[]
+
+
Apply a function to each element of a list -- cgit v1.2.3