diff --git a/_posts/2014-02-16-joining-a-list-of-binaries-in-erlang.md b/_posts/2014-02-16-joining-a-list-of-binaries-in-erlang.md index 010a96c..c48d213 100644 --- a/_posts/2014-02-16-joining-a-list-of-binaries-in-erlang.md +++ b/_posts/2014-02-16-joining-a-list-of-binaries-in-erlang.md @@ -23,9 +23,8 @@ binary_join([], _Sep) -> <<>>; binary_join([Part], _Sep) -> Part; -binary_join(List, Sep) -> - InitAcc = hd(List), - lists:foldr(fun (Value, Acc) -> <> end, InitAcc, tl(List)). +binary_join([Head|Tail], Sep) -> + lists:foldl(fun (Value, Acc) -> <> end, Head, Tail). {% endhighlight %} It works just like you would expect: