Created
September 10, 2015 21:55
-
-
Save matteosister/0320036645c764ba4089 to your computer and use it in GitHub Desktop.
This file contains 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
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