On Thu, Mar 3, 2011 at 9:56 AM, Timothy Baldridge <tbaldri...@gmail.com> wrote:
> I know we have Scriptjure. But has there been any concentrated effort
> to port Clojure to JS? This may sound odd, but personally I would love
> to use Clojure in the browser. Scriptjure would work fairly well, but
> from what I see, it doesn't support persistent maps and instead relies
> on JS objects.

There has been, but it's extremely out of date at this point:

https://github.com/clojure/clojure-contrib/tree/master/clojurescript

That's a pre-1.0 version of Clojure that does indeed compile to
JavaScript.  It supports persistent hash maps and vectors
(pre-transients), lazy sequences (actually, lazy-con, pre-chunking),
and most of the clojure.core functions.  There's no attempt to support
Clojure's concurrency constructs, and it relies on the Java-based
compiler rather than having a port of the compiler itself to
JavaScript.

I gave up trying to hand-port all the features from the Java half of
Clojure's implementation over to JavaScript, with the hope that when
we eventually have clojure-in-clojure this task would be significantly
easier.

You can even try it out in a browser (doesn't work on Macs, I think):
http://clojurescript.n01se.net/

That loads the clojure-to-javascript compiler as a Java applet, after
which you can run Clojure commands in the browser, like:

(-> document .body)

or:

(set! (-> document .body .style .background) "orange")

I'm sorry it's too out of date to be of much real use now, but it does
show it's possible and hopefully has some tidbits that will be useful
in later implementations.

--Chouser
http://joyofclojure.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to