Skip to content

Instantly share code, notes, and snippets.

@wende
Created May 10, 2015 16:27
Show Gist options
  • Save wende/4222d39e83d6394fae53 to your computer and use it in GitHub Desktop.
Save wende/4222d39e83d6394fae53 to your computer and use it in GitHub Desktop.
plik.txt:
en hello bye
pl witam dowidzenia
de guttenmorgen tschus
I13n.ex:
defmacro lang(a) do
File,stream "plik.txt"
|> String.split "\n"
|> Enum.map &String.split/1
|> Enum.filter fn [lan,_,_] lan == a end
|> Enum.map fn [_,b,c] -> quote do
@hi unquote(b) @bye unquote(c)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment