[erlang-questions] Reverses Order of Bytes in Binary
Loïc Hoguin
essen@REDACTED
Fri Jan 9 15:08:05 CET 2015
This doesn't reverse, this will return the same binary. :-)
Would reverse if you put C before Acc every time but that would fill
your memory quickly.
On 01/09/2015 03:03 PM, Max Lapshin wrote:
> reverse(Bin) ->
> reverse(Bin, <<>>).
>
> reverse(<<>>, Acc) -> Acc;
> reverse(<<C,Bin/binary>>, Acc) -> reverse(Bin, <<Acc/binary, C>>).
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
Loïc Hoguin
http://ninenines.eu
More information about the erlang-questions
mailing list