v_function transpiles the supplied v code to C, compiles it, and returns a R function that calls the compiled code. Rcpp::cppFunction, but for v.

v_function(code, verbose = FALSE)

Arguments

code

character v code that defines the v function.

verbose

if TRUE the compilation parameters will be shown.

Value

R function that will call the compiled code

Details

Note: R specific classes in v can be found in the r module.

Examples

if (FALSE) {
# create a compiled function with v code
f <- v_function("fn add_one(i int) int {
   return i + 1
}")

# and use it in R
add_one(2)
}