function twice(f, x) { return f(f(x)); } twice(n => n * n, 3)