Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
defp word_to_code(word) do
String.codepoints(word) # ["J", "a", "v", "a"]
|> Enum.map(&String.upcase/1) # ["J", "A", "V", "A"]
|> Enum.map(&something/1) # [5, 2, 8, 2]
|> Enum.join() # "5282"
end
defp something(char) do
gen_char_code_list(@mnemonics)
|> Enum.find(fn {str, index} -> char == str end)
|> IO.inspect()
|> elem(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.