pow = function(a, b)
{
# the return here is important to ensure the return value is checked.
return(a^b)
}
typeInfo(pow) =
IndependentTypeSpecification(
a = c("numeric", "matrix", "array"),
b = "numeric",
returnType = quote(class(a))
)
IndependentTypeSpecification(
a = c("numeric", "matrix", "array"),
b = new("StrictIsTypeTest","numeric"),
c = new("StrictIsTypeTest",c("numeric", "complex")),
d = as("numeric", "NamedTypeTest"),
e = new("InheritsTypeTest", c("numeric", "complex"))
)
Run the code above in your browser using DataLab