Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Clojure to Scheme to C to the bare metal.

NotificationsYou must be signed in to change notification settings

takeoutweight/clojure-scheme

Repository files navigation

This project is unmaintained and I won't likely investigate any issues.

clojure-scheme

Pervasive tail-call optimization anyone?

A few cosmetic changes to the lovely ClojureScript compiler and we are producing output suitable for compilation to C viaGambit Scheme!

Clojure/West 2013 hosted a talk introducing clojure-scheme. Theslides are online and the corresponding video will be made available this August.

Getting Started

The fastest way to get started is to try the self-hosted clojure-scheme REPL:

  1. Install Gambit Schemefrom source or from anOSX/Win32 installer.
  2. Putgsc on your PATH (make install puts gsc in /usr/local/Gambit-C/bin by default).
  3. InstallLeiningen.
  4. git clone https://github.com/takeoutweight/clojure-scheme.git
  5. In the root clojure-scheme directory, runlein install
  6. In the samples/repl directory, runlein run to build the self-hosted REPL. (src/build.clj demonstrates how to compile .clj files to scheme code).
  7. runsh run-clojure-repl to launch the REPL, and enter(install-clojure-repl) to switch from Scheme mode to Clojure mode.

Performance

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"24157817cljs.compiler> (compile-file "bench.cljs")

... in the shell ...

$ gsc -exe bench.scm$ time ./benchfib 36: 24157817real0m0.775suser0m0.737ssys0m0.009s

About

Clojure to Scheme to C to the bare metal.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors52


[8]ページ先頭

©2009-2025 Movatter.jp