Bill Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

January 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Dec  Feb

What is Lisp best suited for?

Wednesday, January 28, 2004

André Thieme kicked off an interesting thread on comp.lang.lisp when he asked "How long (measured in lines of code) is the longest CL program you know of? I basically want to know for what projects CL could be the language of choice.". People responded by sending in some counts for some well-known (and not so well-known) Lisp applications. Here are some of those figures:

Application SLOC
Jak II game900,000
Emacs editor649,917
Symbolics Genera LispM460,000
CMUCL CL implementation393,941
SBCL CL implementation241,787
Maxima computer algebra system209,297
Hubble space telescope activity planner200,000
Garnet UI development environment155,941
McCLIM GUI manager78,544
CliniSys pharmaceutical clinical trial system70,000
Hemlock editor48,897
Bioinformatics Temporal Logic system15,000
Stock Trading system4,149

Examining some of these applications, it's amazing how much functionality is contained within so few lines of Lisp code. When you compare these Lisp SLOC (source lines of code) figures with SLOC values for equivalent applications that were coded in Java or C, the contrast is striking. For example, in yesterday's post, I referenced an article that provided a breakdown of the SLOC composition for a major Linux distribution. The article indicated that the Linux kernel alone was made up of 2.4 million SLOC (mostly C code). If you look at the above table, compare the Linux 2.4 million SLOC with the 460 thousand SLOC for the Symbolics Genera Lisp Machine (an OS that was arguably far superior to Linux). The Lisp figure is even more incredible in that it represents the entire Lisp Machine OS, including GUI, Lisp runtime, and compilers for Lisp, C, Pascal and Fortran while the Linux figure represents the kernel only!

There were some observations made in the comp.lang.lisp thread that are worth highlighting. Will Hartung made the following comment about one of his projects:

"There's actually another point, perhaps, to be made.

For my little project, the core of the system is 1750 lines of what folks would consider "code".

But, I also have ~5000 lines of "data". But the data is coded using Lisp macros, so...it's really Lisp.

If someone had written my system in C (or most anything else), they would have inevitably used some other format for their data other than their language syntax. Some grammar they had to parse, or something else (like XML) that they could parse "for free".

Also, it's fair to say that my system had no user interface. No GUI, "command line", nothing. Anything I scripted was done using a simple Lisp function wrapper. It lived solely in the listener and relied on it for its interactions with the user. It also, of course, relied upon the editor for the source files.

So, I got a "free" grammar to help me represent my data, and "free" UI, neither of which I had to code at all.

I don't think there's anything inherent in CL that would prevent a system from reaching a million LOC, but I'm more impressed with what it did for me in 1750."
Kenny Tilton followed up with:
"Ah, but there is not yet in the universe enough functionality required for 1m LOC to cover."
To which, Thomas Burdick added:
"If there's ever a 1e6 LOC Lisp program, it'll be either a horrible shame, or the herald of a new era of software engineering, where we can manage insane amounts of complexity."
I don't know if the original poster was able to work out from these figures and the responses on c.l.l. what projects CL was best suited for - it would be interesting to see what conclusions he came to. However, what I think it showed (based on the projects that were listed and the responses that were made) is that Lisp is an ideal choice when there is a high level of complexity that needs to be addressed in an application. The ability to code at a higher level of abstraction when using Lisp makes the language an excellent choice for complex applications. Of course, for Lisp programmers, this is old news. As for what specific applications Lisp is most useful for, I like the comment made some time ago by Kent Pitman:
"...Please don't assume Lisp is only useful for Animation and Graphics, AI, Bioinformatics, B2B and E-Commerce, Data Mining, EDA/Semiconductor applications, Expert Systems, Finance, Intelligent Agents, Knowledge Management, Mechanical CAD, Modeling and Simulation, Natural Language, Optimization, Research, Risk Analysis, Scheduling, Telecom, and Web Authoring just because these are the only things they happened to list."

emacs Copyright © 2005 by Bill Clementson