A partial explanation of why non-commercial Common Lisp distributions don’t have enough libraries
Enough has already been written about how while Lisp, in its Platonic ideal form (as opposed to particular dialects and implementations), is pretty fantastic, a specification that hasn’t been touched for 20-odd years is pretty difficult to work with for many things. (It so happens that it’s still fucking awesome for creating active code generation and model-driven development systems.)
I think there’s a reason why CLISP doesn’t feel as “batteries included” as Python and Ruby do. It’s because “Common Lisp” actually has several languages in it, as well as a large standard library. Consider:
- First there is the base Common Lisp langage; the special forms like lambda and if.
- Then on top of this there is the Common Lisp library. This adds tons of syntactic sugar and all different manner of libraries for working with lists, symbols, functions, macros, and so on. This creates a domain language for working with Common Lisp objects.
- Then there are also multiple embedded domain-specific languages that come with any reasonable Common Lisp implementation.
- There’s CLOS, an awesomely powerful multiple dispatch object system with an unmatched metaobject protocol. Methods, slots (fields), subclasses, and superclasses can all be dynamically inspected, modified, and recompiled all at runtime using simple standard Common Lisp functions. It goes down to even being able to inspect and dynamically modify method signatures. Furthermore, CLOS is metacircular; CLOS is implemented in CLOS.
- There’s loop. It’s called like a function, but actually it’s an embedded psuedocode/imperative language for iteration. In other words, Common Lisp has an entire little language in it for iteration. Practical Common Lisp has an entire chapter on it.
- Then there’s format. See the chapter in Practical Common Lisp for more information and examples.
The Common Lisp specification is 1000 pages, and all of it comes from things that were found to be extremely handy when working on large, difficult software problems. Common Lisp deals with stuff that is timeless. Thus, it’s pretty good if you’re working on a timeless, textbook software problem.
Lisp lends itself very well to declarative metadata. That is why it is so much better than XML for code generation. You get dynamic typing, keyword arguments, optional arguments, closures, a highly interactive environment, macros, a powerful object system, and a powerful condition system instead of just angle brackets and lots of quotation marks. The homoiconic syntax and the ability to pass around code as data is remarkably powerful; if you want to keep an ad hoc block of code that you just banged out together, you can just quote it and then pass it around as a first class citizen.
I am not a Lisp zealot. But to write Lisp off completely is a mistake.