function aux(n, c) { return r => c(n * r); } function factCPS(n, c) { while (n > 0) { c = aux(n, c); n--; } return c(1); }