Babashka: a sprinkle of Clojure for the command line

Meet babashka, a sprinkle of Clojure for the command line.

It’s powered by sci. Other places where I think sci could be useful: you want to let users define a formula in their config like (+ x (* y 2)) and you want a safe way to evaluate this.

Let me know if this is useful to you.


Babashka now also allows executing script files:

1 Like

So, If I have this right,

You’ve written an implementation of Clojure in Clojure, and you can use it to run Clojure faster than normal Clojure? That’s cool! :rofl:


I was revisiting this along with looking back at Truffle.

It seems like going the same route (an interpreter) fits naturally into the truffle framework (expressing clojure via ASTs), except you can then tie into the graal infrastructure better. In “theory” you’d avoid the problems clojure jvm has with ‘eval’, since the truffle-based AST interpreter automatically produces an optimizing JIT compiler (via AST node substitutions and other transforms). The AST nodes and resultant JIT compiler infrastructure are all plain java classes, without any dynamic invoke or class loading (unlike clojure jvm’s eval).

So…you’d have something compatible with clojure, graal-friendly, and should be directly compatible with substrate-vm to enable native-image to work out of the gate. In other words…fast startup and fast runtime in theory (basically native-image would provide an AOT-compiled JIT compiler from the interpreter for you and deploy as a native binary…I think).

Just food for thought; I’m very interested in exploring this option (there’s already some legacy work done in a thesis and elsewhere).


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.