What Clojure libraries can I use if I plan to use the clojurescript compiler?

I'm new to Clojure, but my ultimate goal in learning the language is to use the Clojurescript compiler as I plan on using the generated code in a VM browser.

Since there are tutorials in Clojure and Clojurescript is another compiler, I have been doing Clojure tutorials, but now I got to the point where I want to know where the line is between the libraries that are the core Clojure that will compile the javascript and those that will not.

For example, in a tutorial I'm following for Clojure, I read this, but it looks like this already uses deep Java objects, not core Clojure commons:

user=> (.length a-string)
7
user=> (.substring a-string 3)
"name"
user=> (.substring a-string 3 5)
"na"

// And for static methods

user=> (def rt (.getRuntime Runtime))
#'user/rt
user=> (.freeMemory rt)
30462304

      

At the beginning of the chapter, it said that in Clojure, strings are the same as Java strings, but not what Clojure uses String

from Java, which is completely different.

So if my goal is to develop Clojure targeting a browser, what APIs and types can I use? Is there a simple distinction for this? I imagined that anything not explicitly required (core libs) would be the core of Clojure, and I wouldn't link myself to the libb lib.

Thanks in advance.

+3


source to share


1 answer


If you want to write code to target both Clojure JVM and ClojureScript see cljx .



Without the use of such tools (for inlining code snippets explicitly written for both backends), essential programs are generally not expected to run independently of each other.

+1


source







All Articles