Tech News
← Back to articles

Clj-coll: Clojure collections and sequences in Common Lisp

read original related products more articles

CLJ-COLL: looks like Clojure, tastes like Common Lisp!

This is a Common Lisp implementation of Clojure's APIs for collections, seqs, and lazy-seqs. It provides immutable Cons, Queue, PersistentList, capabilities as well as Vector, Set, and Map analogues built on FSet (but accessed entirely via Clojure APIs).

CLJ-COLL is intended to give a "most naturally integrated" experience of Clojure APIs and immutable data structures within a Common Lisp environment, and to make Common Lisp more approachable to Clojure programmers. If you're a developer who regularly writes both Common Lisp and Clojure, this library is for you.

This is not a Clojure implementation. There is no def , defn , fn , or Clojure-style destructuring. Similarly, there no Clojure-compatible LOOP/RECUR support, use CL:LOOP or other favored CL iteration mechanism. Real FP programmers don't LOOP anyway :-) CLJ-COLL does provide a DOSEQ as well as the full range of Clojure compatible map/reduce/transduce behaviors.

If your goal is to have a full-on Clojure language implementation implemented in Common Lisp, consider Cloture or some other tool, though frankly you may as well use Clojure.

Contents

Clojure APIs provided

At the time of this writing, the first release of CLJ-COLL exports 257 functions, of which 16 are M functions. There are a small handful of capability predicates and miscellaneous things which are not in Clojure, but most of the functions are straight out of Clojure's clojure.core and clojure.set namespaces.

The Clojure Cheatsheet, which by the way has an excellent downloadable version, is your friend here. It summarizes all the APIs grouped by area of functionality, offers popup doc strings, and click-through descriptions with examples at Clojuredocs.org.

Nearly every Clojure 1.12 collection and sequence API is present in CLJ-COLL. There are just a few that aren't (and are documented in this README). (Note that at last glance the cheatsheet is missing 1.12 functionality).

... continue reading