[Source](http://norvig.com/java-lisp.html "Permalink to Lisp as an Alternative to Java")
# Lisp as an Alternative to Java
# Lisp as an Alternative to Java
In the October 1999 _Communications of the ACM_ [Lutz Prechelt][1] had an interesting article entitled [Comparing Java vs. C/C++ Efficiency Issues to Interpersonal Issues][2] which asked 38 programmers to implement versions of a program in C, C++, or Java. The conclusions showed that Java was 3 or 4 times slower than C or C++, but that the variance between programmers was larger than the variance between languages, suggesting that one might want to spend more time on training programmers rather than arguing over language choice. (Or, suggesting that you should hire the good programmers and avoid the bad ones.) The variance for Java was lower than for C or C++. (Cynics could say that Java forces you to write uniformly slow programs.) I applaud this line of work, and hope that more studies of this kind will be done.
It turns out my hopes were answered. First, Prechelt published [another article][3] that covers Tcl, Python, Perl, and Rexx. Also, [Ron Garret (nee Erann Gat)][4] did a [ follow-up study][5] in which he asked programmers to write Prechelt's [test program][6] in Lisp. His results show that the resulting Lisp programs ran faster on average than C, C++ or Java programs (although the fastest Lisp program was not as fast as the fastest C program), and that Lisp programs took less development time than the other languages.
I did not participate in the study, but after I saw it, I wrote my version in Lisp. It took me about 2 hours (compared to a range of 2 to 8.5 hours for the other Lisp programmers in the study, 3 to 25 for C/C++ and 4 to 63 for Java) and I ended up with 45 non-comment non-blank lines (compared with a range of 51 to 182 for Lisp, and 107 to 614 for the other languages). (That means that some Java programmer was spending 13 lines and 84 minutes to provide the functionality of each line of my Lisp program.)
Here is my program:
| ----- |
|
;; Peter Norvig - Programming Challange from Erann Gat:
;; <http://www.flownet.com/ron/papers/lisp-java/>
;; Given a list of words and a list of phone numbers, find all the ways that
;; each phone number can be expressed as a list of words.