A project to rewrite the ClojureCLR engine.
Laziness is a central concept in the handling of sequences in Clojure. Chunking comes along as an efficiency measure. Surprisingly, at the level of implementation we are looking at it, very little needs to be done; laziness is defined most in the Clojure code that builds
clojure.core. We’ll take a look at what is needed at the bottom to support laziness and chunking.
I’d like to draw a roadmap for how to approach implementing the remaining collections.
We have working code.
Actually, more like
Numbersdid a number on me. But we’re good friends now.
Numbersis ready to go. This is a long post;
In which I contemplate the meaning of
Sequential. This is an easy one compared to what you just went through.
Getting started implementing Clojure collections requires methods in
clojure.lang.Utilfor operations such as equality testing and hashing. These methods must operate properly on numeric types. The machinery for this is the class
Wherein I look at hashing and equality in Clojure.
The code with the greatest entanglement across the Clojure codebase comes in the static classes
clojure.lang.Util. How can these classes be restructured to reduce cyclic dependence and improve clarity?
I have to analyze the nature of circular references in the current Clojure implementations in order to avoid making an inelegant F# monolith – massive quantities of code in one file with all the types mutually recursive.
Maps are hugely important in Clojure programming. Internally, they are supported by a specific group of interfaces. Here we will examine these interfaces and provide an incredibly naive implementation. The intention is to make clear the mechanics of these interfaces in a simple setting. Later, when we implement realistic maps, we can wave at this stuff in passing and focus on the intricacies of the data structures themselves.
Now for some homework. Let’s see how well you absorbed the material in the previous post.
Seeing the complexity of the Clojure interface/data-structure ecosystem as we did in the last post can be a bit daunting. But if we start gently we can tease out some of the basic interactions and techniques that underlie how the real Clojure versions of these data structures are implemented.
To build a Lisp, you could perhaps start with the simplest data structure, the cons cell: a simple record structure with two fields that hold pointers and a staple of Lisp implementation from the beginning.
One does not simply start writing a Clojure implementation. One needs a plan.
Introducing a project to rewrite ClojureCLR – ClojureCLR.Next. With this blog, I hope to record some of the thinking I go through in the process, for myself mostly but perhaps for a future maintainer of the project.
subscribe via RSS