Skip to content

Instantly share code, notes, and snippets.

@ToJans
Created July 26, 2013 10:44
Show Gist options
  • Save ToJans/6087952 to your computer and use it in GitHub Desktop.
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.
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