Created
April 1, 2014 08:24
-
-
Save mingshun/9910068 to your computer and use it in GitHub Desktop.
Exercise 5 of Chapter 7, Programming Erlang 2nd Eidition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reverse_bits_in_binary(<<X/binary>>) -> | |
reverse_bits(X, <<>>). | |
reverse_bits(<<B1:1, B2:1, B3:1, B4:1, B5:1, B6:1, B7:1, B8:1, R/binary>>, T) -> | |
reverse_bits(R, <<B8:1, B7:1, B6:1, B5:1, B4:1, B3:1, B2:1, B1:1, T/binary>>); | |
reverse_bits(<<>>, T) -> | |
T. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment