47

I've been programming for years now, working my way through various iterations of Blub (BASIC, Assembler, C, C++, Visual Basic, Java, Ruby in no particular order of "Blub-ness") and I'd like to learn Lisp. However, I have a lot of intertia what with limited time (family, full time job etc) and a comfortable happiness with my current Blub (Java).

So my question is this, given that I'm someone who would really like to learn Lisp, what would be the initial steps to get a good result that demonstrates the superiority of Lisp in web development? Maybe I'm missing the point, but that's how I would initially see the application of my Lisp knowledge.

I'm thinking "use dialect A, use IDE B, follow instructions on page C, question your sanity after monads using counsellor D". I'd just like to know what people here consider to be an optimal set of values for A, B, C and perhaps D. Also some discussion on the relative merit of learning such a powerful language as opposed to, say, becoming a Rails expert.

Just to add some more detail, I'll be developing on MacOS (or a Linux VM) - no Windows based approaches will be necessary, thanks.

Notes for those just browsing by

I'm going to keep this question open for a while so that I can offer feedback on the suggestions after I've been able to explore them. If you happen to be browsing by and feel you have something to add, please do. I would really welcome your feedback.

Interesting links

Assuming you're coming at Lisp from a Java background, this set of links will get you started quickly.

  1. Using Intellij's La Clojure plugin to integrate Lisp (videocast)
  2. Lisp for the Web
  3. Online version of Practical Common Lisp (c/o Frank Shearar)
  4. Land of Lisp a (+ (+ very quirky) game based) way in but makes it all so straightforward
  5. Install Clojure and Sublime 2 on MacOS an excellent getting started guide
  6. Look at the Clojure in Action book. Worked for me.
4
  • 1
    By reading "ANSI Common Lisp" and "On Lisp" by Paul Graham.
    – duros
    Nov 25, 2010 at 14:22
  • 2
    On Lisp rocks (I've not read ANSI Common Lisp), but as an intro book, Practical Common Lisp > On Lisp. IMO, at least. (I read On Lisp first, but PCL was what got me into CL.) Nov 25, 2010 at 14:42
  • Have to say that I'm enjoying reading PCL at the moment - excellent footnotes about the history of the language really give a feel for the community
    – Gary
    Nov 25, 2010 at 15:10
  • 1
    My first introduction to Lisps were watching the famous Structure and Interpretation of Computer Programs. Then I watched Rich Hickey's Clojure for Java Programmers. I would recommend these videos as a good introduction.
    – WuHoUnited
    Jun 5, 2012 at 13:27

9 Answers 9

19

This is probably counter to most peoples' recommendations, but steer clear of Emacs to start with, unless you already know it. Especially if you're used to modern IDEs/editors.

I'm speaking from experience; I tried to start with Emacs, but having to learn the language AND the editor at the same time really frustrated me (especially since Emacs is so different from other tools). I ended up chucking it, getting started with PLT Scheme (now Racket) which comes with a comparatively simple cross-platform IDE, a centralized package repository and fabulous docs (including an intermediate tutorial specifically aimed at web development). After I got a clean grip on Lisp, I ended up going back to Emacs, picking up EL/CL by way of Practical Common Lisp and Xah's Elisp Guide. Basically, as I see it, you need to know a Lisp before you can use Emacs effectively, and you need to know Emacs in order to be very effective with CL/Elisp. This means that you can either pick up Scheme, or learn Common Lisp through some other editor first (LispWorks personal, probably).

If you already know Emacs, then yeah Elisp is the natural step (though how you would enjoy Emacs use without knowing Elisp first is beyond me).

YMMV of course, this is just what I found helped.

Since your current blub is Java, you could probably get a lot of mileage out of Clojure, Armed Bear or Kawa. I haven't tried any of them myself, not being a Java guy, but Clojure specifically comes highly recommended from other Lispers I know. It seems like the ability to keep your current VM and IDE might help with the learning process.

8
  • I already had some basic fluency in emacs when I started. Emacs does have a very steep learning curve! Nov 26, 2010 at 8:03
  • +1 because my previous experiences with Emacs have been less than wonderful (that does not stop me from wanting to know it and having Lisp built-in - as Thorbjorn has pointed out - means I get to use my Lisp knowledge in my day job)
    – Gary
    Nov 26, 2010 at 8:59
  • 4
    @Thorbjørn Ravn Andersen - Did that. Twice. Still found myself constantly using CUA shortcuts (which are off by default in Emacs). The worst was closing my editor with an accidental cut + intended copy (C-x C-c). I love Emacs to death, and pretty much live in it now, but realize that at first, you're fighting years of muscle memory telling you C-s is Save, not Search and that Undo is C-z. I won't recommend that kind of frustration to someone whose intention is learning Lisp. Learn the language first, realize you love it, then start fighting your hands with a clear goal in mind.
    – Inaimathi
    Nov 26, 2010 at 12:33
  • 1
    @Inaima, well power comes with a price, and the Emacs bindings predate CUA so blame IBM :) Also Ctrl-C + Ctrl-v isn't CUA :)
    – user1249
    Nov 26, 2010 at 15:25
  • 1
    @Geoffrey van Wyk - PLT is great to start with, but there are some limits you run into after a while that made me switch over to CL/Emacs once I had my bearings. YMMV. I did a write-up a while ago, if you're interested in details langnostic.blogspot.com/2010/09/… As far as the LispWorks question; I have to believe that they're targeting large teams (where the company buys the tools) or consultants (who usually make enough that the price tag is justified). Not sure how it's working out for them, but it's not the approach I would have picked.
    – Inaimathi
    Dec 13, 2010 at 12:26
10

Well,You can hit two birds by reading SICP ;One is learning LISP(i mean scheme is a dialect of Lisp) and other is great insight into how to program.Period!!

1
  • 1
    +1 for the link - a quick scan through seems to show that it's very detailed but also rather dry (read academic) in it's approach. I'm a big fan of "the experts voice" coming through when reading text but it seems like a good overall reference.
    – Gary
    Nov 26, 2010 at 9:29
10

Conrad Barski has a great tutorial called Casting SPELs in Lisp (SPEL is his acronym for macros). It involves making a simple Adventure-type game, and jumps right into Lisp macros. He also has been working on an introductory book that is now available at:

Learn to program Lisp, one game at a time.

And, from the Table of Contents:

  • Create your own web server, and use it to play browser-based games

I don't know what this implies for web development (as in HTML pages) using Lisp, however. :)

Update - I see someone mentioned the book "Structure and Interpretation of Computer Programs", which reminded me that MIT has put online, the entire SICP Video Lectures by Hal Abelson and Gerald Jay Sussman. You might have found the book dry, but the lectures are excellent. Although they're Scheme-based, they still get across the basic concepts also in Lisp, very nicely. Well worth downloading and watching.

0
8

To get a good basic introduction to the language, read Peter Seibel's Practical Common Lisp. The book's excellent.

Setting up emacs and SLIME can be tricky for a newbie, where "tricky" varies in magnitude depending on your OS. As usual, Windows gets the short end of the stick, but people have done the hard part and written it up (SBCL, Emacs, SLIME).

Once that's out the way, Planet Lisp referenced an article recently describing how to set up Hunchentoot and nginx.

OS-specific edit: MCLIDE might be a good place to start. I installed it, but haven't had the chance to actually use it, so I can't say anything useful about it. It certainly looks interesting!

Edit: Eclipse has the Cusp plugin, too.

0
6

Already a lot of great answers, but assuming you want to dive head-first into web development with a Lisp, I have a few more ideas.

Clojure is the first Lisp I've seen to have really excellent full-stack web frameworks that are ready for prime-time.

  • Noir is a solid web framework with routing, templating, etc., similar to Sinatra but a bit more feature-rich. It uses Ring, which is basically Clojure's equivalent of Rack in Ruby.
  • Korma is a SQL abstraction library that pairs really well with Noir.
  • Pinot is a client-side framework written entirely in ClojureScript, which brings us to:
  • Clojurescript is a compiler for Clojure which targets Javascript.

If you hadn't noticed, I just covered the entire web stack and it's all written in Clojure.

I find Clojure a bit easier to get started with then Common Lisp, with far better feature set/library support than Scheme.

If you're coming from a Java background at all, it has the added benefit of running on the JVM, which gives you access to the whole Java stdlib when you need it.

The available documentation isa work-in-progress, as are the frameworks themselves. But there's a pretty good tutorial right here.

As far as editors go... if you're comfortable with vim, you can use vim with SLIMV. If you like emacs, emacs/SLIME is okay. There's pretty good Eclipse and NetBeans support for Clojure (or so I'm told), but I generally use TextMate (although Sublime Text 2 is quickly becoming my editor of choice). I know I'm missing out on a little Lisp magic not using a more integrated environment, but I'm happy to hit ⌘-Tab to swap between my editor and REPL; your mileage may vary.

If you want a book to jumpstart you, I recommend Programming Clojure by Stuart Halloway and Aaron Bedra. The 2nd edition just came out from PragProg, so it's up-to-date.

Happy Lisping!

1
5

Another commentor, Inaimathi, recommended this book a few days ago: The Little Schemer

Received it today and I can say as someone who has a very hefty library of programming books acquired over many years, that I may have only read one chapter, but I will definitely need a hardback version of this. It reads like the Tao Te Ching, lots of little snippets of divine wisdom regarding the language. It may say Scheme, but it was originally called "The Little LISPer", the languages at the level it discusses are sufficiently similar to be taught as one.

It is not an advanced text, but has a mission to instil the principles of the language and what it is really for, how to think like it. I believe it would be an excellent starter to LISP.

NB. The Programmer Competency Matrix actually mentions this book in the top level of competency of things to look for. (see Books section)

0
4

A very nice place to start using Lisp is inside the Emacs editor, where it can be used to redefine just about anything. You want the 'e' key to insert the time of date, just write a small Lisp snippet to generate the string and bind it to the e key. Done.

This will also allow you to actually USE what you learn in a daily setting, if you happen to use a plain editor during the day.

1
  • +1 for the "use what you learn" advice. I'm an Intellij bod for the day job, but I just might be able to get my paws on emacs in our very restricted software environment.
    – Gary
    Nov 25, 2010 at 20:17
3

If you'll be developing on a Mac, you may want to try Clozure CL. It comes with an IDE that has Emacs-compatible keystrokes, and there's a bridge to Objective C so you can write Cocoa applications.

Also, I've read Practical Common Lisp, but found Successful Lisp to be helpful as well.

Finally, some patience on your part will be rewarded. Productivity and minor victories will come pretty quickly, but the big win may take a while.

0
2

I have a copy of ANSI Common Lisp right here by my desk. I pick it up every couple of years and get a couple of chapters through, then get stuck on a couple of exercises and it slips down the priority list. That probably tells you more about me than the book though. The book seems entirely competent...

1
  • Maybe reading through the answers and comments to this question will give you the impetus to work towards a higher goal. Have a crack at the PCL link and tell us what you think...
    – Gary
    Nov 26, 2010 at 9:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.