Friday, June 20, 2008

Quick Tip, list join

Another "lists:join" :

Join = fun([X|Rest], D) ->
[ X | [ [D,E] || E <- Rest ] ]
end.

Usage:

io:format("~s~n", [Join(["a", "b", "cde", "h", "k", "lm"], $,)]).
a,b,cde,h,k,lm
ok

No comments:

Sticky