Created
April 14, 2011 14:22
-
-
Save mikeobrien/919564 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Some function | |
Func<int, int, int, int> multiplyThree = (a, b, c) => a * b * c; | |
// Lets curry it by breaking it up into multiple functions that only have one arg | |
Func<int, Func<int, Func<int, int>>> multiplyThreeCurried = (a) => (b) => (c) => multiplyThree(a, b, c); | |
// This is curried, yay! | |
var result = multiplyThreeCurried(10)(2)(3); | |
// This is partially applied | |
var multiplyByThirty = multiplyThreeCurried(10)(30); | |
result = multiplyByThirty(3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment