Skip to content

Instantly share code, notes, and snippets.

@jskeet
Created May 8, 2017 10:39
Show Gist options
  • Save jskeet/957f94ef874e9d6813ce3d108b9f2d3a to your computer and use it in GitHub Desktop.
Save jskeet/957f94ef874e9d6813ce3d108b9f2d3a to your computer and use it in GitHub Desktop.
public static string FizzBuzz(int n)
{
var fizz = Test(3, "fizz");
var buzz = Test(5, "buzz");
return fizz(buzz(x => x))(n.ToString());
Func<Func<string, string>, Func<string, string>> Test(int d, string s) =>
x => n % d == 0 ? _ => s + x("") : x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment