Skip to content

Instantly share code, notes, and snippets.

@devanarch
Created April 30, 2018 15:35
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save devanarch/a55956d97e9271a3579101f90644ee31 to your computer and use it in GitHub Desktop.
Func<int,int> add2 = val => val + 2;
Func<int,int> add3 = val => val + 3;
Func<Func<int, int>, Func<int, int>> compose(Func<int, int> f) => g => val => g(f(val));
Func<int, int> add5 = compose(add2)(add3);
Func<int, int> add10 = compose(a => a + 3)(a => a + 7);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment