Learn R Programming

mmb (version 0.13.3)

make.varClosure: Creates a closure over a variable and returns its getter and setter.

Description

Creates a closure over a variable and returns its getter and setter.

Usage

make.varClosure(initVarVal = NULL, valValidator = NULL)

Arguments

initVarVal

the initial value of the closed variable.

valValidator

an optional function to validate each value. Function must return boolean. If this function returns FALSE for any value, an error is thrown.

Value

list with entries 'get' and 'set' which are getter/setter for the variable that a closure was made over.