Skip to content

Instantly share code, notes, and snippets.

@gusaaaaa
Created December 12, 2017 13:43
Show Gist options
  • Save gusaaaaa/c718b2e3661254c5c56c5db69e9b1b70 to your computer and use it in GitHub Desktop.
Save gusaaaaa/c718b2e3661254c5c56c5db69e9b1b70 to your computer and use it in GitHub Desktop.
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