unenclose: Unenclose a closure.

View source: R/unenclose.r

unencloseR Documentation

Unenclose a closure.

Description

Unenclose a closure by substituting names for values found in the enclosing environment.

Usage

unenclose(f)

Arguments

f

a closure

Examples

power <- function(exp) {
  function(x) x ^ exp
}
square <- power(2)
cube <- power(3)

square
cube
unenclose(square)
unenclose(cube)

hadley/pryr documentation built on Jan. 5, 2024, 10:38 a.m.