Developed a prototype to access ROOT from LISP

Dear all,

We have developed a prototype for a Lisp interface to ROOT and wrote a paper on arxiv [1].

I was at CERN in the late 90’s using ROOT with C++. Then I professionally switched to Finance and Python, it was good, but soon I felt something was lacking to the point that I gave up programming for some years. But I continued my search and found the Sussman books [2] and since then I am sold to Lisp. Subsequently I teamed up with a Physics Professor and we drafted the manuscript (and code [3]).

The idea is to compile Lisp (specifically its Clojure dialect via the Ferret compiler) to C++, thus adding a layer on top. The crucial point is that all the necessary type information for both compilation and polymorphic dispatch is not mixed with the Lisp code but stored in a separate XML-like file.

Hope you enjoy the read and for abundant feedback!


[1] [2312.13295v1] A functional scripting interface to an object oriented C++ library
[2] (open access) Functional Differential Geometry
[3] GitHub - kloimhardt/LisRoot: Calling into CERN's Root data analysis framework from Lisp


The concept of compiling Lisp to C++ using the Ferret compiler and storing type information in a separate XML-like file for seamless interoperation is fascinating. It seems like a promising approach, especially for those in scientific, engineering, and quantitative finance fields.

I’m intrigued by the potential of automatically creating multimethods and even generating the Malli file itself. This could streamline the process significantly for those working with C++ libraries.

1 Like

Nice work, Markus! Thanks for the shout out to jank, the native Clojure dialect which uses Cling for JIT compilation. I hope, for the next paper, that it’s ready for you to use. :slight_smile:

For anyone interested in this space, Ferret is a great light weight Clojure-like which compiles to native executables. jank is a full-on Clojure dialect which supports REPL-based development and all of Clojure’s dynamic features by relying on ROOT’s Cling compiler for JIT compilation. jank is also a C++ library and can be embedded in any C++ application. Within jank, we can write inline C++ and interpolate back to jank code itself. All of this blurs the boundaries between Clojure and C++ while allowing jank to be significantly faster than Clojure JVM.

You can follow the latest development of jank on its blog or Github repo.


@jeaye reading your blog posts, I find intriguing an idea that came up in a Q&A between you and @vvassilev : Lisp Macros could very elegantly bring to jank/C++ROOT what Numba and JAX.jit respectively bring to Python/NumPy. The idea shows up at the end of the recently written excerpt of your youtube-video.

The Lisp/ROOT interop described in our paper is entirely based on Macros. It all started with a little blog post and grew with time dedicated by a second author being a professional writer.