General Autotranslation

The beakerx object synchronizes values between languages. BeakerX's current implementation works with metaprogramming and serializing the objects to JSON, so it's not recommended for more than a few MB of data. Using Arrow and shared memory to remove that limitation is on the agenda.

Start in Groovy:


In [ ]:
beakerx.bar = "a groovy value"

Translate to JavaScript:


In [ ]:
%%javascript
console.log(beakerx.bar);

In [ ]:
%%javascript
beakerx.bar = [23, 48, 7, "from JS"];

Groovy:


In [ ]:
beakerx.bar

Translate to Python:


In [ ]:
%%python
from beakerx.object import beakerx
beakerx.bar

In [ ]:
%%python
from beakerx.object import beakerx
beakerx.bar = [2, 'python', 'value']
beakerx.bar

Translate to Scala:


In [ ]:
%%scala
beakerx.bar

In [ ]:
%%scala
beakerx.bar = Array(3.14,"scala", "value")

Groovy:


In [ ]:
beakerx.bar

Translate to Clojure:


In [ ]:
%%clojure
(beakerx :get "bar")

In [ ]:
%%clojure
(beakerx :set "bar" [345, "clojure", "value"])
(beakerx :get "bar")

Groovy:


In [ ]:
beakerx.bar

Translate to java:


In [ ]:
%%java
return NamespaceClient.getBeakerX().get("bar");

In [ ]:
%%java
Object[] arr = {new Integer(10), "java", "value"};
NamespaceClient.getBeakerX().set("bar", arr);
return NamespaceClient.getBeakerX().get("bar");

Groovy:


In [ ]:
beakerx.bar

Translate to kotlin:


In [ ]:
%%kotlin
beakerx["bar"]

In [ ]:
%%kotlin
beakerx["bar"] = arrayOf(33, "kotlin", "value")
beakerx["bar"]

Groovy:


In [ ]:
beakerx.bar