v_function allows you to write v functions and call them within R.

v_function('fn add(x int, y int, z int) int{
  sum := x + y + z
  return sum
}')

add
add(1, 2, 3)