Skip to content

Instantly share code, notes, and snippets.

@matteosister
Created September 10, 2015 21:55
Show Gist options
  • Save matteosister/0320036645c764ba4089 to your computer and use it in GitHub Desktop.
Save matteosister/0320036645c764ba4089 to your computer and use it in GitHub Desktop.
defmodule SimpleFC do
require Integer
def even(n), do: Integer.is_even(n)
def negate(n), do: not n
def compose(func1, func2) do
fn (n) ->
func2.(func1.(n))
end
end
def not_even(n) do
compose(&even/1, &negate/1).(n)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment