func factorial(of n: Int) -> Int { func f(_ n: Int, _ r: Int) -> Int { n <= 1 ? r : f(n - 1, r * n) } return f(n, 1) }