source("Interface.R")
source("ProxyClass.R")
loadInside(.GlobalEnv)
ev <- InsideInterface()
ev$Eval(1)
xx = ev$Eval(1:3)
ev$Get(xx)
ev$Call("sum", xx)
y = ev$Call("sum", xx, .proxy = TRUE)
xm <- ev$Call("matrix", 1:12, 3, 4)
ev$Get(xm)
ev$Call("rnorm", 10, sd = .001, .proxy = FALSE)
p1 <- ev$Call("SimplePop", sizes = 100, birthRate = .1, deathRate = .08)
p2 <- ev$MethodCall(p1, "evolve")
ev$Eval("system('uname')", .returnValue = FALSE)
sizes <- ev$FieldGet(p1,"sizes", .proxy =FALSE)
ev$FieldAssign(p1, "sizes", c(0,sizes))
require(jsonlite)
ev$Import("package:jsonlite", "fromJSON", "toJSON")
detach(2)
ev$Call("toJSON", 1:3, .proxy = FALSE)
objectAsJSON(matrix(1:12,4,3), ev)
xl <- list(a=1, b=2, "text")
intfFromJSON(objectAsJSON(xl, ev))
intfFromJSON(objectAsJSON(as.environment(xl[1:2]), ev))
intfFromJSON(objectAsJSON(p1, ev))
pop1 <- SimplePop(sizes = 100, birthRate = .1, deathRate = .08)
for(i in 1:10) pop1$evolve()
intfFromJSON(objectAsJSON(pop1, ev))
