Javascript to clojure

Viewed 1957

I am aware of ClojureScript - possibility to compile clojure code to javascript, but is it possible to do the reverse, take some subset of javascript code and translate it back to clojure?

5 Answers

Yes, this is definitely possible and a very actionable idea. You could actually use the Rhino Javascript compiler to convert the Javascript to Java classes and could then rig something up to call the Java classes from Clojure. You don't get the source code, but you can leverage the libraries in Clojure code.

I just happened to come across a JavaScript to Common Lisp transpiler called CL-JavaScript.

Related