Skip to content

Instantly share code, notes, and snippets.

@matteosister
Last active September 23, 2015 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matteosister/4d1ba9224b304d3739f2 to your computer and use it in GitHub Desktop.
Save matteosister/4d1ba9224b304d3739f2 to your computer and use it in GitHub Desktop.
defmodule InfixFC do
@doc """
define an infix operator <|> to compose functions
"""
defmacro left <|> right do
quote bind_quoted: [left: left, right: right] do
fn (v) -> left.(right.(v)) end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment