diff options
author | Jesper Louis Andersen <[email protected]> | 2016-04-09 17:17:59 +0200 |
---|---|---|
committer | Jesper Louis Andersen <[email protected]> | 2016-04-09 17:22:37 +0200 |
commit | c660e30a7dd781f71bed050b20c3e2d0b069e063 (patch) | |
tree | aff243cd344c25e75787ece31d13599aef9e5195 /lib/stdlib/doc/src | |
parent | 9e3d98d67a9fbc62aa54b3035b953eb94486cdf7 (diff) | |
download | otp-c660e30a7dd781f71bed050b20c3e2d0b069e063.tar.gz otp-c660e30a7dd781f71bed050b20c3e2d0b069e063.tar.bz2 otp-c660e30a7dd781f71bed050b20c3e2d0b069e063.zip |
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.
Diffstat (limited to 'lib/stdlib/doc/src')
-rw-r--r-- | lib/stdlib/doc/src/lists.xml | 15 |
1 files changed, 15 insertions, 0 deletions
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 @@ -262,6 +262,21 @@ flatmap(Fun, List1) -> </desc> </func> <func> + <name name="join" arity="2"/> + <fsummary>Insert an element between elements in a list</fsummary> + <desc> + <p>Inserts <c><anno>Sep</anno></c> between each element in <c><anno>List1</anno></c>. Has no + effect on the empty list and on a singleton list. For example:</p> + <pre> +> <input>lists:join(x, [a,b,c]).</input> +[a,x,b,x,c] +> <input>lists:join(x, [a]).</input> +[a] +> <input>lists:join(x, []).</input> +[]</pre> + </desc> + </func> + <func> <name name="foreach" arity="2"/> <fsummary>Apply a function to each element of a list</fsummary> <desc> |