This project is unmaintained and I won't likely investigate any issues.
Pervasive tail-call optimization anyone?
A few cosmetic changes to the lovely ClojureScript compiler and we are producing output suitable for compilation to C via Gambit Scheme!
Clojure/West 2013 hosted a talk introducing clojure-scheme. The slides are online and the corresponding video will be made available this August.
The fastest way to get started is to try the self-hosted clojure-scheme REPL:
- Install Gambit Scheme from source or from an OSX/Win32 installer.
gscon your PATH (
make installputs gsc in /usr/local/Gambit-C/bin by default).
- Install Leiningen.
git clone https://github.com/takeoutweight/clojure-scheme.git
- In the root clojure-scheme directory, run
- In the samples/repl directory, run
lein runto build the self-hosted REPL. (src/build.clj demonstrates how to compile .clj files to scheme code).
sh run-clojure-replto launch the REPL, and enter
(install-clojure-repl)to switch from Scheme mode to Clojure mode.
Gambit seems to be a promising compile target for Clojure:
(scm*  (load "core")) (ns bench) (defn fib [n] (if (or (identical? n 0) (identical? n 1)) 1 (+ (fib (dec n) ) (fib (- n 2))))) (prn "fib 36:" (fib 36))
... in the Clojure REPL ...
cljs.compiler> (time (fib 36)) "Elapsed time: 1138.814 msecs" 24157817 cljs.compiler> (compile-file "bench.cljs")
... in the shell ...
$ gsc -exe bench.scm $ time ./bench fib 36: 24157817 real 0m0.775s user 0m0.737s sys 0m0.009s