Created
December 12, 2017 13:43
-
-
Save gusaaaaa/c718b2e3661254c5c56c5db69e9b1b70 to your computer and use it in GitHub Desktop.
This file contains 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
defmodule Enigma do | |
defmacro is_alpha(char) do | |
quote do: (unquote(char) >= 65 and unquote(char) <= 90) or (unquote(char) >= 97 and unquote(char) <= 122) | |
end | |
def break_code([head | tail], offset) when is_alpha(head) do | |
[head + offset | break_code(tail, offset)] | |
end | |
def break_code([head | tail], offset) do | |
[head | break_code(tail, offset)] | |
end | |
def break_code([], _) do | |
[] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment