Skip to content

Instantly share code, notes, and snippets.

@mingshun
Created April 1, 2014 08:38
Show Gist options
  • Save mingshun/9910270 to your computer and use it in GitHub Desktop.
Save mingshun/9910270 to your computer and use it in GitHub Desktop.
Exercise 1 of Chapter 7, Programming Erlang 2nd Edition
reverse_bytes_in_binary(<<X/binary>>) ->
reverse_bytes(X, <<>>).
reverse_bytes(<<Byte:8, R/binary>>, T) ->
reverse_bytes(R, <<Byte, T/binary>>);
reverse_bytes(<<>>, T) ->
T.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment