top | item 8281482

Why I like Common Lisp

171 points| _19qg | 11 years ago |p-cos.blogspot.com | reply

178 comments

order
[+] mck-|11 years ago|reply
What I like most about Common Lisp is how it made me a better programmer. The different paradigm of coding trains your brain in different ways which offer perspectives on problem solving that I otherwise wouldn't have considered.

Note that for the above effect, it is irrelevant what Lisp you choose. Yes, it also applies to learning any additional language, but because Lisp is a different breed altogether (as opposed to Fortran-derived languages), more value is to be had from the diversity.

I used to be a huge fan of Common Lisp (even wrote my own series of blogs on why I love it a few years ago) -- still use it in my daily work -- but I came to realize that it's not perfect. There are many things that Clojure has improved upon, e.g. consistent accessor methods, shared immutable data structures vs copying, and probably many more once I dive deeper -- there's a reason why even pg started recommending Clojure over CL or Arc.

I've been coding in Common Lisp for about 3-4 years. Even the algorithm of my startup is written in Common Lisp. There are definitely moments of sheer joy when I switch back and forth between Javascript and Common Lisp. But also moments of annoyance... sometimes certain algorithms are just more naturally imperative, and CL makes it hard not to write recursive.

tl;dr learning a Lisp is highly recommended. It does not matter which flavour. Or just go read SICP.

[+] ScottBurson|11 years ago|reply
It's perfectly easy to write imperative code in CL. You have objects, you have vectors, you have every control structure operator ever conceived except CALL/CC, ... what else do you need?

On the other hand, if you want to write more functionally, CL also now has shared immutable data structures. Check out FSet: http://www.ergy.com/FSet.html

[+] wtbob|11 years ago|reply
> CL makes it hard not to write recursive.

Say what? Are you sure that you don't mean Scheme? CL has LOOP…

[+] wirrbel|11 years ago|reply
do you have a link/source for paul graham recommending Clojure?
[+] pnathan|11 years ago|reply
I love Common Lisp; I've been writing Common Lisp at home for something around 7 years. It's fast, flexible, expressive, and deeply programmable.

I won't say it doesn't have its warts: the namespacing and packaging systems are kludgey, and the extensibility of built-in operators is poor. It's a dynamic language to boot, which implies type derivations are often estimates at best (painful sometimes on a poorly tested codebase).

But, Common Lisp, above all that, is an integrated development system which allows live and fluid development. I can't stress enough that it is a deep and joyful technology which lets me achieve more faster in it.

I only wish there were jobs in it. :-/

[+] pivo|11 years ago|reply
I have never been more productive than when I'm developing with Common Lisp in Emacs with Slime. It's a really fantastic environment.
[+] malisper|11 years ago|reply
Don't forget paredit, ac-slime, and redshank.
[+] pkaye|11 years ago|reply
What exactly do you develop with Common Lisp?
[+] pjmlp|11 years ago|reply
Still, I think they fail short from the Common Lisp commercial offerings in terms of the whole package.
[+] TheMiller|11 years ago|reply
I just find it utterly fascinating that these discussions on the merits of (Common) Lisp still draw 100 comments within such a short time. This has been going on for decades, in many different venues. This by itself should clue newcomers in to the notion that the language (family) may be worth examining in some detail. :)
[+] johan_larson|11 years ago|reply
Anyone have something better than a wild guess about whether Lisp is getting more or less popular? It was never a very popular language in the first place, having lost out to the spawn of Algol.
[+] csdrane|11 years ago|reply
Not too long ago I was researching what Lisp to learn. I contemplated Common Lisp, but ultimately chose to learn Clojure. The latter won because the development community seems to have more life to it. Additionally, the fact that one can import existing Java libraries is a huge plus. Very much enjoying everything so far.
[+] yodsanklai|11 years ago|reply
What are the advantages of Lisp over ML (more specifically, I know Scheme and OCaml). My knowledge of scheme is probably incomplete, but for what I remember, Scheme is OCaml without static typing, sum types, pattern matching, module system. Scheme is more dynamic (dynamic types, code as data, symbols) but i find type safety much more important (and in a language with type inference, it comes with little overhead).

Am I missing something about Common Lisp?

[+] Chattered|11 years ago|reply
The macros davidxc mentions are a big win. The important point about Lisp macros is that they are not a separate technology you have to learn, as you have with Camlp4. Once you know Lisp, you automatically know macros.

Lisps are also much better at reflection than the MLs. In Common Lisp, you can rebind function symbols from a backtrace, and then carry on as if nothing happened. Changing a class definition updates every instance in the system to conform to that new definition, which makes interactive testing a joy. You can get hold of your namespaces as Lisp objects and interact with them as any other data structure, and see the effects reflected correctly in your runtime. CLOS is the peak of this sort of thing. And most lisps allow you to save a snapshot of the runtime image, which is awesome.

The MLs were originally written in Lisp, and inherit some of these features, but Ocaml, not so much. Still, I love Ocaml.

[+] davidxc|11 years ago|reply
Common Lisp has macros. Paul Graham's book On Lisp is usually pointed to as the best treatment of macros in Lisp. CL also has many more features than Scheme, as mentioned in the other comments here.
[+] chubot|11 years ago|reply
I learned Lisp/Scheme many years ago and am learning OCaml now (and loving it). I guess you could be uncharitable and say that Scheme is OCaml without types, etc. That seems inaccurate though; I will have to think about that :)

But one important thing is that Lisp is its own meta language. With OCaml there are changing and competing meta languages as far as I understand (camlp4, MetaOCaml). The simplicity of the language and meta-language being the same leads to a totally different style of programming.

[+] TheMagicHorsey|11 years ago|reply
I'm no expert, but it seems like its easier to get started with Clojure than Common Lisp. There are tons of free Clojure resources and tutorials. There is a great IDE that works quite well (LightTable), and the command line tools with Leinengen are pretty sweet too.

I realize that you can probably optimize your Lisp code a lot more than you can your Clojure code since Clojure is on the JVM, but right out of the box Clojure performs as well as naive Common Lisp, so its probably a more attractive Lisp for most beginners.

[+] eudox|11 years ago|reply
Common Lisp has all those tools, what it does lack is a well-designed website that says "Here's how you start".

The closest thing to that is probably the common-lisp.net website, and that's just an unfinished barebones Bootstrap example.

I've been meaning to design a better one, but that's going to take some time.

[+] kilon|11 years ago|reply
I have been coding for fun for 26 years and played around with most popular languages. Common lisp has by far the worst community I have experienced. There is a minority of people that elitist , rude even hostile to anyone that is new to the language. I never gave up a language because of the community but CL community really was very hard to tolerate. Elitism and snobbery is far from uncommon in the coding world unfortunately.

I think as a language it deserve the reasonable praise it gets and certainly a beautifully designed language, powerful and yet flexible. I enjoyed very much coding in it and with the help of lispers I was introduced to a language / environment I fallen in love with Smalltalk , Squeak and now Pharo.

[+] hvd|11 years ago|reply
coincidentally I am working through land of lisp, recommend it: http://www.amazon.com/Land-Lisp-Learn-Program-Game/dp/159327... Do I see myself using lisp in production code? Not in the near future. I do think there is value in learning something that exposes you to thinking in different ways, till now what Ive gained is that Python is pretty lispy!
[+] matrix_nad|11 years ago|reply
How long was the learning curve to CL, if you don't mind me asking?

I remember learning Lisp and all that reverse polish notation was very unorthodox to me.

[+] Slackwise|11 years ago|reply
> I remember learning Lisp and all that reverse polish notation was very unorthodox to me.

I really, really want to answer this, but it's worthy of a chapter in a book. May I summarize instead?

1. Lisp syntax is tree syntax.

An expression such as this:

    (+3 (* 4 5))
Is a tree such as this:

       +
    3     *
        4   5
2. Lisp macros can treat raw Lisp expressions as trees, and transform them into other trees, as well as avoid typical function call evaluation.

3. Lisp has little to effectively no syntax. Since all forms (outside of special reader forms) are in simple lists/trees, you effectively know all there is to know about reading Lisp. (Although, you do need to understand the Triforce of Functions, Macros, and Special Forms, but they're worthy of their own chapters to explain. They're still lists, though.)

4. The nodes[1] of a Lisp tree are also their own data structure, known as Cons Cells[CC]. These allow for easy manipulation and construction of trees, as well as easy recursion by poping off the first part of a cons cell, processing/consuming it, then sending the rest of the list back into the function. Essentially stack-like processing of lists. So while recursive functions can be rather ugly in other languages, they're rather elegant in Lisp, and easy to work with.

Jeeze, I can probably keep going, and adding more and more points and elaborating on their purpose, but it'd be better to just study Lisp on your own instead. I only know cursory Common Lisp, so I can't recommend any books or sources, but I can instead recommend learning Clojure. "Programming Clojure" has been stated to be a good starting book, but I've mostly read "Clojure Programming" from O'Reilly and "The Joy of Clojure". These are also good books, but I'm not sure which is best for beginners.

[1]: Okay, to be more pedantically accurate, Lisp 'trees' are just cons cells linking to more cons cells. It's a bit unweildly to think of all Lisp expressions as cons cells rather than nested function calls or trees. [CC]: http://en.wikipedia.org/wiki/Cons

[+] mrottenkolber|11 years ago|reply
For me it took 2-3 years to feel proficient using CL. I still learn new thing every week (for the last five years or so) and I can safely say that I will be learing for at least five more years. CL is a big language.
[+] wtetzner|11 years ago|reply
Frankly, arithmetic expressions are really the only part that's unusual. There's not much difference between:

    println("some text")
and

    (println "some text")
[+] agumonkey|11 years ago|reply
What was the hard part ? the prefixness ? the parens or the language basic building blocks (cons, map*, lambdas) ?
[+] enupten|11 years ago|reply
The prefix-notation is annoying when you're doing anything mathematical. It's sad that CL doesn't come with a infix reader by default, I'm sure there is one on quicklisp.
[+] brudgers|11 years ago|reply
This article illustrates one of the hurdles the Common Lisp community often sets before itself when it produces a piece of marketing. It points to resources that are not immediately obtained or that don't directly touch on the large subjects mentioned.

For example, one of the important capabilities mentioned in the article is getting close to the metal with profilers and hand tuning code and the runtime environment. Yet none of the links discuss this directly or provide tutorials.

The discussion about the wonders of CLOS suggests reading The Art of the Meta-Object Protocol - a $35.00 345 page dead tree tome which Amazon will get to you in about a week if you opt for free shipping. Graham's Ansi Common Lisp is of course even more obscure - it's been out of print for years and from Amazon you're in the realm of individual sellers [my anecdote is that it took about a month to get the copy I ordered - the seller was a nice person but it was a couple of weeks before they read their email from Amazon letting them know someone had purchased their copy].

The author goes on to recommend LispWorks as a platform. It's $1500 for 32 bits in North America and $4500 if you want to use all 64bits that your OS probably runs under. Sure there's a free version, it's 32-bits, not licensed for commercial work, and crippled. Don't get me wrong, the free version is probably fine for playing around with, but this article targets people for whom tuning the heap and GC are appealing, and this tends to be a professional rather than hobbyist market segment.

The "early Web 1.0" vibe is unfortunately common when the Common Lisp community attempts to promote Common Lisp. Let's face it, the linked Lisperati site looks a GeoCities page [a good one]. The LispWorks page requires four clicks to get to the price of non-crippleware. The author's own guide links to academic papers and black and blue on white websites.

The issue is that the Common Lisp Community is not just sending signals that most of the potential market ignores, it's that it is sending signals that turn the potential market off. I will unequivocally say that crippleware is no longer a viable approach to achieving significant developer mindshare. The landscape is open source and $4500 a seat [and calling it Enterprise Edition] is only going to hit some [potentially profitable] edge cases.

Of all the places accessible from the author's post, the only one that looks in touch with the present is the original article on BlogSpot. Everything else screams "This ain't for you" at most people.

It makes Racket look hip. And that's hard to do.

[+] wtbob|11 years ago|reply
Yes, it is remarkably difficult to get into Common Lisp—or at least, it was until Practical Common Lisp (http://www.gigamonkeys.com/book/) came out, and it still is for topics PCL doesn't cover in-depth (e.g. CLOS).

On Lisp is definitely not a good beginners' resource. It's a great book in many ways, but I would never recommend it over PCL.

Lispers in general tend to have a fairly old-fashioned mentality (due, no doubt, to many of us being older) about many things. I think it's fair to say that there's much less of a sharing mindset, and much more of a closed mindset; the other way of wording that is that lispers are getting things done and making money doing them, not spending time updating community sites and sharing code (although there are some excellent open-source packages out there).

I'd really like to figure out how to build more of a Common Lisp community. The more I use it, the more I realise that it's a solid, professional, well-thought-out language for developing solid, flexible, reliable software. It's not perfect, but much of what looks like warts at first are actually features. Using it is the closest thing to expressing my thoughts as code. It really is a joy.

[+] _delirium|11 years ago|reply
There are plenty of things I think could be updated about CL, and I wouldn't recommend LispWorks as a first place to start either. But I think you'd have to be part of a really niche area of tech to consider the very concept of reading books to be obsolete. If I want to get into a new language, the first thing I look for is whether there is a good introductory book, vs. just a scattered set of HOWTOs/READMEs/Wikis.

However there are books online as well, nowadays, if you really prefer to read on a screen. Seibel's Practical Common Lisp is a good starting point: http://www.gigamonkeys.com/book/

[+] eudox|11 years ago|reply
>The issue is that the Common Lisp Community is not just sending signals that most of the potential market ignores, it's that it is sending signals that turn the potential market off.

Absolutely agree. The Lisp community could attract hundreds of new people overnight simply by learning a little CSS.

The one thing every other "hip and cool" language community has is that it has learnt that presentation matters. The people who use Python, Ruby and Node have all learnt this, but it seems most Common Lispers are perfectly happy with plain-old HTML pages that look like they were made in 1996.

[+] ScottBurson|11 years ago|reply
As a long-time Lisper myself, I am a little surprised at the emphasis on LispWorks in this thread. I never used it much myself, and when I did I wasn't that crazy about it, though that was a dozen years ago so who knows. But the point is, Clozure CL and SBCL are just fine for anything I do. I would recommend Clozure CL to newcomers; SBCL is faster (I think), but more complex to use.
[+] pjmlp|11 years ago|reply
It is a sad state of affairs that kids these days expect everything for free on IT, whereas in other professions one needs to pay for its tools.

Maybe it is showing my grey beard age, but I have bought quite a lot of software in my life, books(!) and even pay donations to open source projects.

As someone that lives from software development, I know how much it costs to transform my hours into something I can give in the supermarket and not all types of FOSS can be adapted to consulting.

Every time someone complains to me about software prices, I make them go through how would they manage to get enough money pay their current salaries. Then the prices don't seem that expensive any longer.

[+] mwcampbell|11 years ago|reply
> I will unequivocally say that crippleware is no longer a viable approach to achieving significant developer mindshare. The landscape is open source

$4500 is definitely steep, but I sure hope you're wrong about commercial development tools no longer being viable. Not because I develop such tools myself, but because I want good tools. How will developers be paid to create great development tools, if it doesn't happen to be in the best interest of a company like Google, Apple, Red Hat, or Joyent to fund the work? See also: http://sealedabstract.com/rants/of-wizards-and-magical-machi...

We've become really spoiled. And that applies to me as much as anyone.

[+] samth|11 years ago|reply
> It makes Racket look hip. And that's hard to do.

Hey!