Created
July 26, 2013 10:44
-
-
Save ToJans/6087952 to your computer and use it in GitHub Desktop.
See how easy it is to extend Elixir: implement a "for x in y" in 3 simple lines.
This file contains hidden or 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
defmacro for({ :in, _, [left, right] }, do: block) do | |
quote do | |
Enum.map unquote(right), fn unquote(left) -> unquote(block) end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment