Skip to content

Instantly share code, notes, and snippets.

@mikeobrien
Created April 14, 2011 14:22
Show Gist options
  • Save mikeobrien/919564 to your computer and use it in GitHub Desktop.
Save mikeobrien/919564 to your computer and use it in GitHub Desktop.
// 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