One of the hurdles I face in learning a new language, as you probably do too, is that I am always looking at it from the point of view of my current context, more specifically the current set of languages, and in particular, my favorite language, which is Ruby. I end up comparing everything I look at to Ruby’s ease of expression, the way I can quickly do real practical stuff, and the amount of libraries already out there.
Lisp, rather than being a language, is a family of languages, the two most common varieties being Common Lisp and Scheme, of which there are numerous implementations in the wild. The original Lisp dates back to 1958, making it the second oldest language still in use after Fortran. So they say. Yet generations of computer scientists have rallied around Lisp, proclaiming its power and expressiveness as the ultimate among languages.
Lisp is a very interesting concept. There are no keywords like you would expect if you were to tackle a new language. No if, else, let, loop. No reserved keywords. It’s not what you’re used to.
Instead, what you have, are forms. Forms are expressions, lists (and nested lists) of elements encased in parentheses, where the first element is usually interpreted as the name of a function that is applied to the rest of the elements, which are taken to be the arguments. The interesting thing is that data is represented in the same way. That leads to one of the interesting aspects of Lisp: code is data. Code can be treated as data, and (potentially) the other way round. Function definitions themselves are essentially just lists. (The name “Lisp” comes from LISt Processing, by the way).
There are a number of nuances, mainly brought about by certain modifiers like single quotes, backticks and commas, that cause the interpreter to treat the code/data in certain ways.
So actually, Lisp has an incredibly simple syntax. You can probably learn it in a matter of minutes. But it is not that easy to understand what Lisp is, nor to grasp the implications of what can be achieved with such a simple syntax. That can take years to learn and master. It really is a lot to get your head around. It would be really useful to have something like a little project with which to cut your teeth on Lisp. Which brings me to my next hurdle:
It is incredibly difficult to find good examples of practical things you can do with Lisp. It’s not like when I learned Ruby, where the world is already full if useful and interesting things you can do in a minimal amount of time in a very natural, expressive way.
Furthermore, not everyone is that keen on Lisp. Someone at work tried to convince me that it is a lot of hype. However, there are two things in particular that I always refer back to, and which keep me coming back:
The first is a quote by Eric Raymond (some know him by his initials, ESR):
“Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.”
The other are several essays by Paul Graham, as well as a stunning essay (of which I have read about half, I have not had the energy to dig into the meaty parts) by Slava Akhmechet, entitled “The Nature of Lisp“. Both make reference the above quote of Eric Raymond’s, and in the aforementioned essay, Slava also speaks about the sudden enlightenment that came after having studied Lisp really hard for a long time.
Whether or not I can every achieve that level of enlightenment, is very questionable, but it certainly has appeal.
So my motivation currently for learning Lisp is not so much due to what it can purportedly do (or rather what you can do with it), but what you can learn from it; how it supposedly makes you think about code. Having this take on the matter is rather helpful when trawling through reams of documentation that illustrate the fundamentals with highly theoretical examples.
Speaking of documentation, if you are looking for documentation on Lisp, there is no shortage all over the internet. In fact, there are a number of PDF books you can download for free, some of them rather old but still highly relevant.
And speaking of Lisp books, the other day I bought a copy of Conrad Barski’s “The land of Lisp“. It looks like a cutely comical introduction to Lisp, and the music video is a real seller. However, if you expect anything like the incredibly brilliant “why’s (poignant) guide to ruby“, you will be sorely disappointed. The first few chapters are really dry going. (Though presumably I did not get to the fun bits yet). That also reminds me that I need to do a full-length, sincere apology to the author of why’s (poignant) guide after dissing his extraordinary piece of work some years ago on this very blog, only to discover shortly afterward what a dimwit I had been.
In conclusion, I don’t know whether I will ever be a dedicated Lisp user. But I must admit that I am very intrigued by all the hype around it, to the point of actually believing it. I imagine that if you are a computer scientist (or have at least studied computer science), you will probably grasp the power of Lisp a lot more easily and find an immediate use for it. For the likes of me, it is probably a lot more of an uphill battle.