Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

30 lines (25 sloc) 0.343 kb
function plus(a, b) {
minus(a, minus(0, b))
}
function times(a, b) {
if (eq(b, 0)) {
0
} else {
plus(a, times(a, minus(b, 1)))
}
}
function eq(a, b) {
if (minus(a, b)) {
0
} else {
1
}
}
function factorial(n) {
if (eq(n, 1)) {
1
} else {
times(n, factorial(minus(n, 1)))
}
}
print(factorial(4))
Jump to Line
Something went wrong with that request. Please try again.