in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

Not Necessarily Dot Net

March 2011 - Posts

  • Which Lisp?

    Intro

    Let's cut to the chase. This post is for people who, for whatever reason, have decided they want to learn lisp. Pretty much the first question that comes after that decision is "Which one?"

    Several people have tried to answer that question over the years. The answers seem to all boil down to either "Don't bother" or "It depends."

    Personally, I think that any decent programmer should be proficient in a wide variety and style of programming languages. And I don't mean C, C++, C#, and Java. Those are all practically the same language. I think that learning something in the lisp family is worthwhile for its own sake...though it is more than a little dangerous. It may make you hate whatever language you use in your day-job, because it's so much less expressive.

    Please Note: I hate religious flame wars about stupid things like which text editor or which programming language is better. This is an attempt at a balanced look at the current state of the major different versions of Lisp, as I understand it. I'm not going to pretend I'm a lisp expert--in this arena, I'm still a very humble beginner. It's just that I spent quite a bit of time researching this question, and the experts seem very reluctant to offer any opinions about this matter. I'm sure they have their reasons, and this post is probably a case of a fool rushing in where angels fear to tread.

    The Family

    Since you (somehow) made it here, I'm going to assume you've already figured out that lisp really is a family of related languages (much like the C-style languages I mentioned above, which descended from Algol). Pretty much everything I know about how it grew and evolved came from the Net, written by much better writers than I. So I'll skip the history lesson and get straight to the comparison.

    Scheme

    A flawless little gem. Carefully designed, shaped, and polished. This is perfect for academia and people who want to build their own...well, pretty much everything. If you want to learn how to write computer programs, or just love elegant simplicity, this is the language for you.

    If you actually want to build something useful, you either have to re-invent the wheel (over and over), or use vendor-specific extensions. Which lock you into a specific implementation fairly early-on.

    My recommendation: Racket. It has a very thorough set of extensions, and the IDE that comes with it seems pretty thorough.

    Common Lisp

    An ugly ball of mud. With warts.

    Common Lisp was designed for getting stuff done. It's all about practicality. I've read that it and Perl share that attitude. Which is more than a little ironic. From what I've been able to gather, Larry Wall hated lisp's parentheses so much that it drove him to create Perl. I figured I'd love anything he hated, and it turns out I was correct.

    This is a huge language. You probably won't begin to see the benefits of using it unless you're involved in, say, a gigantic project with shifting and under-specified requirements. Though it's also great for weekend hobbyists. Needing to track down and learn libraries for "normal" modern computer-usage (GUI and sockets are the two complaints I've seen most often...pretty much every distribution comes with a socket implementation, but you have to install a 3rd-party library to get anything portable) can overshadow the productivity gains for projects with in-between scope. But, once you have those installed, you don't have to worry about the language changing to a "new, improved, and incompatible" version (the frozen standard is a feature, much like the parentheses).

    My Recommendation

    Well, umm...It Depends. :-)

    I've been advised to start with the LispWorks Personal Edition. It's really a free trial of their Professional Edition, with a couple of limitations: there's a limit to the heap size, and you can't run the image for more than 5 hours at a time. And you can't create redistributable images with it. It also denies CLIM access (though I'm told CAPI is much nicer all around anyway). If you fork over the cash to upgrade to the Professional Edition, you still can't redistribute the compiler.

    The next-best recommendation I've run across is "Use Clozure [note the 'z': I'll get to Clojure shortly] until you know why you need a different implementation." If nothing else, its IDE (Mac-only) sounds pretty sweet. Well, compared to the alternatives.

    OTOH, SBCL is probably the most popular CL dialect. It's definitely the most popular open source version. You're a little more likely to get help on IRC if you're using it. And pretty much any library you run across is almost guaranteed to work with SBCL. The only real downside to it is that the developers have been struggling with getting it to work on Windows for years. There is an official Windows release, but, last I saw, it had issues with multi-threading.

    The only real choice for a development environment (except CCL's IDE) is Emacs with SLIME. There's something similar available for Vim, but the most positive thing I've ever seen written about it ran along the lines of "It didn't make me want to slit my wrists" (note that that's completely anecdotal: I'm happy enough with SLIME that I've never bothered trying this plugin). This morning, I ran across CUSP, which is a plug-in for Eclipse that uses SLIME's back-end. So there may be another viable option now.

    Arc

    Ahh...the hundred year programming language. Odds are, pretty much everyone who winds up here will be familiar with Paul Graham's writings. If, by some crazy chance you aren't, I highly recommend them.

    For anyone who hasn't looked at it yet: Arc takes a sort of middle-road between scheme and common lisp. With a bit of syntactic sugar added where Mr. Graham believes it make sense.

    I've been told that anyone who wants to learn lisp for its own sake might as well start with Arc. You can cram in all the hard parts in one afternoon, then switch to a "real" lisp until Arc's ready to be released into the wild. It's kind of like learning Latin to make the Romance languages easy.

    OTOH, if you just want to pick a specific lisp dialect, Arc probably isn't it, for now. You probably wouldn't take the time to learn Latin if you really only cared about learning French.

    I don't have any idea what sort of development environment options are available here. My guess you're pretty much on your own.

    Clojure

    Clojure seems to be very similar to Arc. Except that it runs on the JVM, and exists in the "real world."

    I've run across some fairly snarky debates about whether Clojure still qualifies as a lisp, because of all the syntax (the parentheses are a feature...honest). Or about how superior it is to Common Lisp, because it's gotten rid of so many warts and has such newer, fresher batteries included. It feels almost like sibling rivalry to me. Clojure's sparking a lot of interest (much more than CL) in the real world, but CL's been around a lot longer, with a lot more collected wisdom under its wings.

    If you're going to use it, I think Emacs and SLIME are, again, your best bets.

    My recommendation: I think Clojure's extremely interesting, if still immature. The community members I run across tend to act like puffed-up bantam roosters with a grudge and the need to prove themselves. I plan on checking back in about 5 years, after some of the rough edges have had a chance to wear away.

    Edit: One of the huge advantages touted for Clojure is that it runs on the JVM. Which is going to be much more heavily tested and battle-scarred than the VM under any non-JVM-based lisp. And it grants access to all the Java libraries. It seems worth keeping in mind. OTOH...ABCL has these exact same advantages.

    The Rest

    There are all sorts of other family members who deserve mentioning. Hedgehog Lisp, PicoLisp, and newLISP were the first 3 that sprang to mind. Personally, I learned just enough about them to decide they don't fit my current requirements. It wouldn't be fair for me to have any opinion about them beyond that, much less to express such in public.

    And then there's javascript. I've seen raging debates about whether or not it's part of the Family. It has the same flexible outlook on life, but the syntax is all wrong. It's kind of like a love-child between Algol and Lisp.

2015 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems