Created
October 8, 2014 18:06
-
-
Save TheEvilDev/86145cbf9e1fcf6032a5 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
public static class ExampleCurrying { | |
public static int Add(Func<int> a, Func<int> b){ | |
return a() + b(); | |
} | |
public static int Multiply(Func<int> a, Func<int> b){ | |
return a() * b(); | |
} | |
public static int Divide(Fun<int> a, Func<int> b){ | |
return a() / b(); | |
} | |
public static int FindTheSumDividedByProduct(Fun<int> a, Fun<int> b){ | |
var add = () => Add(a, b); | |
var multiply = () => Multiply(a, b); | |
return Divide(add, multiply); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment