Learn R Programming

pryr (version 0.1.6)

unenclose: 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

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

square
cube
unenclose(square)
unenclose(cube)

Run the code above in your browser using DataLab