You need to first install GraalVM, and then set your PATH so that you
get the GraalVM binaries (incluing the GraalVM version of node
).
You can then install R and Ruby via
gu -c install org.graalvm.r
gu -c install org.graalvm.ruby
Then, use this small tweak to ClojureScript's
Node REPL so you can pass arguments to node
. An easy way to do this is via this deps.edn
:
{:deps {org.clojure/clojurescript
{:git/url "https://github.com/mfikes/clojurescript"
:sha "3e13026898acaa0f89eaa6eaa3be9411e084cf2d"}}}
Then launch the node
REPL as usual, but we'll pass in two extra GraalVM arguments, --polyglot
and --jvm
:
clj -m cljs.main -ro '{:node-args ["--polyglot" "--jvm"]}' -re node -r
Then have fun playing with multiple languages from ClojureScript!
cljs.user=> (reduce + [1 2 3 5 7 11])
29
cljs.user=> (.eval js/Polyglot "R"
"sum(c(1,2,3,5,7,11))")
29
cljs.user=> (.eval js/Polyglot "ruby"
"[1,2,3,5,7,11].inject(0){|sum,x| sum + x }")
29