Created
January 31, 2022 10:15
-
-
Save borkdude/c8537c6a4d6cdb399cf3bcf92b6b4a74 to your computer and use it in GitHub Desktop.
GraalVM Node + nbb + JVM Clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ $GRAALVM_HOME/bin/node --jvm --polyglot --vm.cp=$(clojure -Spath) $(which nbb) | |
user=> (.-version js/process) | |
"v14.18.1" | |
user=> (require '["path" :as path]) | |
nil | |
user=> (path/resolve ".") | |
"/Users/borkdude" | |
user=> (def Clojure (js/Java.type "clojure.java.api.Clojure")) | |
#'user/Clojure | |
user=> (def clj:require (.var Clojure "clojure.core" "require")) | |
#'user/clj:require | |
user=> (.invoke clj:require (.read Clojure "clojure.set")) | |
nil | |
user=> (def clj:set:union (.var Clojure "clojure.set" "union")) | |
#'user/clj:set:union | |
user=> (def unioned (.invoke clj:set:union (.read Clojure "#{1 2 3}") (.read Clojure "#{4 5 6}"))) | |
#'user/unioned | |
user=> (def clj:prn (.var Clojure "clojure.core" "prn")) | |
#'user/clj:prn | |
user=> (.invoke clj:prn unioned) | |
#{1 4 6 3 2 5} | |
nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment