juliaFun | R Documentation |
Creates an R function that will call the Julia function with the given name when it is called. Like any R function, the returned function can also be passed as a function argument to Julia functions.
juliaFun(name, ...)
name |
the name of the Julia function |
... |
optional arguments for currying: The resulting function will be called using these arguments. |
if (juliaSetupOk()) {
# Wrap a Julia function and use it
juliaSqrt <- juliaFun("sqrt")
juliaSqrt(2)
# In the following call, the sqrt function is called without
# a callback to R because the linked function object is used.
juliaCall("map", juliaSqrt, c(1,4,9))
# may also be used with arguments
plus1 <- juliaFun("+", 1)
plus1(2)
# Results in an R callback (calling Julia again)
# because there is no linked function object in Julia.
juliaCall("map", plus1, c(1,2,3))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.