1
0
Fork 0

Fix binary_join

This commit is contained in:
Daniel Kempkens 2014-07-14 21:32:28 +02:00
parent 482aba3a03
commit 01e0266dba

View file

@ -23,9 +23,8 @@ binary_join([], _Sep) ->
<<>>; <<>>;
binary_join([Part], _Sep) -> binary_join([Part], _Sep) ->
Part; Part;
binary_join(List, Sep) -> binary_join([Head|Tail], Sep) ->
InitAcc = hd(List), lists:foldl(fun (Value, Acc) -> <<Acc/binary, Sep/binary, Value/binary>> end, Head, Tail).
lists:foldr(fun (Value, Acc) -> <<Acc/binary, Sep/binary, Value/binary>> end, InitAcc, tl(List)).
{% endhighlight %} {% endhighlight %}
It works just like you would expect: It works just like you would expect: