Carp: A statically typed Lisp, without a GC, for real-time applications.

This looks rather good.

Carp: A statically typed lisp, without a GC, for real-time applications.

It is what it says. It’s a Lisp, with some inspiration from Clojure in terms of syntax, that’s designed for writing fast native code like games and … (w00t!) audio applications. Etc.

It actually compiles into C.

It takes some syntactic inspiration from Clojure (so it looks like Clojure and Clojure editors should handle it fine)

But it also takes inspiration from ML.

It has an ML-style type-system with type-inference. And the best way of representing type information in a Lisp program that I’ve seen.

Using a form called “the“.

So you write something like

(the Int sexp)

This declares that the sexp needs to evaluate to the type Int.

Because it has type-inference, the type of much of the rest of the code can be deduced just from a few of these explicit specifications.

Carp also (allegedly) has an ML style module system. I have no idea what that means because I’ve not used ML. But it is something I hear a lot of people raving about.

However, Carp is a low-level language designed as a C-level language. It has the usual Lisp-style dynamic lists, but only for use at compile-time. It also has macros executed at compile-time.

At run-time code, you only have more primitive types : Ints, Floats, etc. Plus data-structures including Arrays, some kind of map / dictionary, structs and Sum Types. So you get the power and type-safety of ML / Haskell algebraic data-types but at a C-level without depending on heap allocation.

It also has some kind of Rust-like “ownership semantics” for pointers. I haven’t quite understood this yet, but again it looks sensible.

In all, this looks a really tasteful and well thought out combination of good ideas from a number of places (much like Clojure itself) that will add up to a much nicer than C experience for writing the sorts of things that I usually write with C.

All I’ve done so far is installed it and run a couple of examples, but I can well see myself trying to use this to do the coding for some audio / VCVRack stuff.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.