diff --git a/com.oracle.truffle.r.pkgs/graalvm/R/g.R b/com.oracle.truffle.r.pkgs/graalvm/R/g.R index a39bb05199fd0a4c31a0846d32d718849cca4537..6be25c8445ae89aac701b3d6efc633e5dc4bc18f 100644 --- a/com.oracle.truffle.r.pkgs/graalvm/R/g.R +++ b/com.oracle.truffle.r.pkgs/graalvm/R/g.R @@ -337,7 +337,9 @@ sendAttempt <- function(code, echo, mimetype) { if (resp$status_code >= 400) { stop(respObj) - } else { + } else if (echo) { respObj + } else { + invisible(NULL) } } diff --git a/com.oracle.truffle.r.pkgs/graalvm/R/graalvm.R b/com.oracle.truffle.r.pkgs/graalvm/R/graalvm.R index 2c6c4b66e7195f7e6c09c8bb991b06269e8a5044..74bcf413033c89b656bc37935fc79dfa33e4f80e 100644 --- a/com.oracle.truffle.r.pkgs/graalvm/R/graalvm.R +++ b/com.oracle.truffle.r.pkgs/graalvm/R/graalvm.R @@ -6,21 +6,20 @@ #' # Loading and setting up #' #' library(graalvm) -#' graalvm.setup("~/work/graalvm-0.21") +#' graalvm.setup("~/work/graalvm-0.25") #' #' # Code execution -#' g(v <- runif(1e8)) +#' g(v <- runif(1e3)) #' g(f <- function(x) { s <- 0; for (i in seq_along(x)) s <- s + x[[i]]; s }) #' g(system.time(f(v))) -#' g(system.time(f(v))) #' #' g.js("1 < 2") #' g.rb("$a = 2") #' #' -#' # Paired variables +#' # Coupled variables #' -#' # Create and initialize paired variables: +#' # Create and initialize coupled variables: #' gset.r(a1, TRUE) #' gset.js(a2, c(1,2)) #' gset.rb(a3, list(a=1,b="2")) @@ -32,17 +31,18 @@ #' g.rb("$a3") #' #' g(a1 <- FALSE) +#' # Sync the local a1 with the remote a1 #' gget(a1) #' a1 #' -#' # Paired functions +#' # Coupled functions #' -#' # Create a paired function +#' # Create a coupled function #' gset.r(measure, function(n) { system.time(runif(n)) }) -#' # Execute the local version of the paired function +#' # Execute the local version of the coupled function #' measure(1e8) -#' # Execute the remote version of the paired function -#' g(measure(1e8)) +#' # Execute the remote version of the coupled function +#' g(measure(1e8)) # Try a couple of times #' #' # Executing a script file #' diff --git a/com.oracle.truffle.r.pkgs/graalvm/man/graalvm.Rd b/com.oracle.truffle.r.pkgs/graalvm/man/graalvm.Rd index 96c0d86c24f63bc09feff2103b15a36d0111a6cb..b37a22e7112cb28b6f85221c38e54abe9433e908 100644 --- a/com.oracle.truffle.r.pkgs/graalvm/man/graalvm.Rd +++ b/com.oracle.truffle.r.pkgs/graalvm/man/graalvm.Rd @@ -12,21 +12,20 @@ of GraalVM to GNUR users. # Loading and setting up library(graalvm) -graalvm.setup("~/work/graalvm-0.21") +graalvm.setup("~/work/graalvm-0.25") # Code execution -g(v <- runif(1e8)) +g(v <- runif(1e3)) g(f <- function(x) { s <- 0; for (i in seq_along(x)) s <- s + x[[i]]; s }) g(system.time(f(v))) -g(system.time(f(v))) g.js("1 < 2") g.rb("$a = 2") -# Paired variables +# Coupled variables -# Create and initialize paired variables: +# Create and initialize coupled variables: gset.r(a1, TRUE) gset.js(a2, c(1,2)) gset.rb(a3, list(a=1,b="2")) @@ -38,17 +37,18 @@ g.js("a2") g.rb("$a3") g(a1 <- FALSE) +# Sync the local a1 with the remote a1 gget(a1) a1 -# Paired functions +# Coupled functions -# Create a paired function +# Create a coupled function gset.r(measure, function(n) { system.time(runif(n)) }) -# Execute the local version of the paired function +# Execute the local version of the coupled function measure(1e8) -# Execute the remote version of the paired function -g(measure(1e8)) +# Execute the remote version of the coupled function +g(measure(1e8)) # Try a couple of times # Executing a script file