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))