Skip to content

Instantly share code, notes, and snippets.

@i
Created May 8, 2014 23:31
Show Gist options
  • Save i/f75f21f6c56eb55c414c to your computer and use it in GitHub Desktop.
Save i/f75f21f6c56eb55c414c to your computer and use it in GitHub Desktop.
corecursive factorial
function fact(x) {
return (function f(n, m, x) {
if (n == x) return m;
return f(n+1, m*(n+1), x)
})(0, 1, x);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment