Timothy
--
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)
Persistent maps would be pretty tricky to support in Javascript. I
don't think there's any way of supporting them that wouldn't result in
a significant performance impact, because you'd have to build them on
top of the native mutable maps.
- James
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/