10.6 Forcing - Reiterated

Only required if the argument is not evaluated before the new function is created:

power1 <- function(exp) {
  stopifnot(is.numeric(exp))
  function(x) x ^ exp
}

x <- 2
square <- power1(x)
x <- 3
square(4)
#> [1] 16