Skip to content

Instantly share code, notes, and snippets.

@TheEvilDev
Created October 8, 2014 18:06
Show Gist options
  • Save TheEvilDev/86145cbf9e1fcf6032a5 to your computer and use it in GitHub Desktop.
Save TheEvilDev/86145cbf9e1fcf6032a5 to your computer and use it in GitHub Desktop.
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