Learn R Programming

wyz.code.offensiveProgramming (version 1.1.24)

matchFunctionSignature: Retrieve Function Arguments.

Description

Compare two functions signatures and tells if they are exactly the same.

Usage

matchFunctionSignature(aFunction_f_1, aFunctionTemplate_f_1 = function(){})

Value

A boolean value.

Arguments

aFunction_f_1

a function or primitive. Not a string!

aFunctionTemplate_f_1

a function or primitive to be used as model. Not a string!

Author

tools:::Rd_package_author("wyz.code.offensiveProgramming")

Maintainer: tools:::Rd_package_maintainer("wyz.code.offensiveProgramming")

Details

To get TRUE as result, function and function model must share exactly the sames attributes names and values, including default values if any used.

Examples

Run this code
matchFunctionSignature(sum, function(..., na.rm = FALSE) { NULL })
# [1] TRUE

matchFunctionSignature(sum, function(..., na.rm) { NULL })
#[1] FALSE

Run the code above in your browser using DataLab