Gray code: Difference between revisions
Content deleted Content added
→{{header|Erlang}}: Adopt decode algorithm from Euphoria. |
|||
Line 552:
=={{header|Erlang}}==
{{trans|
<lang erlang>-module(gray).
-export([encode/1, decode/1]).
encode(N) -> N bxor (N bsr 1).
decode(
decode(0,G
</lang>
Demonstration code:
|