Clojure 1.7 introduced Reader Conditionals which allows you to write one Clojure file (with a .cljc) extension, and use conditional expressions to let Clojure make Java calls and ClojureScript make JavaScript calls. How easy or hard it would be to convert a Clojure library to a Clojure/ClojureScript library depends entirely on how much platform specific code the library has used and what similar facilities exist in the target platform.
I dare say most library authors would welcome a pull request to support cljc if you did the work of porting it. On Fri, Sep 11, 2015 at 12:27 AM Dan Campbell <[email protected]> wrote: > On Tuesday, September 8, 2015 at 7:14:57 PM UTC-4, Linus Ericsson wrote: > > This is a good question. > > > > Until very recently, there was no easy way to share code between > > Clojure and ClojureScript at all, although the pure clojure-core stuff > > did work pretty much out of the box. > > > > Still it's quite common that a library has dependencies to other > > jvm-stuff, or uses jvm-stuff under the hood. Or, the horror, calls > > external processes. If this is the case your out of luck/has to > > convert the jvm-specific things to something availiable in cljs/js. > > > > What libraries are you thinking of? > > > > /Linus > > > > > > 2015-09-09 0:09 GMT+02:00 Dan Campbell: > > > Is it always necessary to rewrite a Clojure library in Clojurescript, > in order to use its functions? > > > > > > There are several third-party Clojure libraries that I'd like to use > in a web page, but cannot find a way to call the Jar methods directly. > > > > > > > > > > > > -- > > > Note that posts from new members are moderated - please be patient > with your first post. > > > --- > > > You received this message because you are subscribed to the Google > Groups "ClojureScript" group. > > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > > To post to this group, send email to [email protected]. > > > Visit this group at http://groups.google.com/group/clojurescript. > > Hi Linus, > > Well, I'll need a library that that solves algebraic equations, at some > point. Generally, math libraries, like Clojuratica and Expresso. > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. > -- Daniel -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
