Skip to content
Snippets Groups Projects
Commit 9274d6a3 authored by Zbynek Slajchrt's avatar Zbynek Slajchrt
Browse files

Several fixes in documentation and g.R

parent 6b84c34f
No related branches found
No related tags found
No related merge requests found
......@@ -337,7 +337,9 @@ sendAttempt <- function(code, echo, mimetype) {
if (resp$status_code >= 400) {
stop(respObj)
} else {
} else if (echo) {
respObj
} else {
invisible(NULL)
}
}
......@@ -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
#'
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment