runFunction: Run a _'function'_

View source: R/runFunction.R

runFunctionR Documentation

Run a function

Description

Run a function from an object, according to the mentioned evaluation mode, and to the chosen type factory

Usage

runFunction(object_o_1, functionName_s_1, arguments_l, evaluationMode_o_1)

Arguments

object_o_1

the object to consider

functionName_s_1

a single string that is the name of the function to run

arguments_l

a list of arguments to pass to the function

evaluationMode_o_1

an evaluation mode object. See EvaluationMode

Value

A list with names

status

a single boolean. Always TRUE when evaluation mode is standard_R_evaluation. Otherwise, will reflect result validity in the chose evaluation mode.

value

the result of the computation, might be a scalar or not, a warning, an error, ...

mode

the evaluation mode used to check the results

function_return_type_check

available if mode is different of standard_R_evaluation

parameter_type_checks

available if mode is type_checking_inforcement

Author(s)

Fabien Gelineau <neonira@gmail.com>

Maintainer: Fabien Gelineau <neonira@gmail.com>

See Also

Refer to FunctionParameterTypeFactory and runFunction.

Examples

##---- typical case ----
library('data.table')
source(system.file('code-samples/frt-defs/good/full/AdditionFI.R',
                   package = 'wyz.code.offensiveProgramming'))
fi <- AdditionFI()
runFunction(fi, 'addDouble', list(34, 44.6), EvaluationMode(defineEvaluationModes()[1]))
runFunction(fi, 'addDouble', list(34, 44.6), EvaluationMode(defineEvaluationModes()[2]))
runFunction(fi, 'addDouble', list(34, 44.6), EvaluationMode(defineEvaluationModes()[3]))

wyz.code.offensiveProgramming documentation built on Sept. 25, 2023, 9:05 a.m.