Skip to content

Instantly share code, notes, and snippets.

@trygvea
Created March 12, 2013 22:49
Show Gist options
  • Save trygvea/5147822 to your computer and use it in GitHub Desktop.
Save trygvea/5147822 to your computer and use it in GitHub Desktop.
def Y = { le -> ({ f -> f(f) })({ f -> le { x -> f(f)(x) } }) }
def factorial = Y { fac ->
{ n -> n <= 2 ? n : n * fac(n - 1) }
}
assert 2432902008176640000 == factorial(20G)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment