function_: Define a type-safe function.

Description Usage Arguments Value Examples

View source: R/function_.R

Description

Using function_ is an alternative way to define a function where arguments are type-safe. Arguments are specified as name ~ type or as type:name ~ value. The last argument to function_ is the body of the function. If no type is specified, it will default to some, which is true for anything.

Usage

1

Arguments

...

Arguments for the function and the function body as the last argument.

Value

a type-safe function

Examples

1
2
3
f <- function_(a ~ integer, b ~ character: "Hello, World", {
  rep(b, a)
})

smbache/ensurer documentation built on May 30, 2019, 5:01 a.m.