46

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.
Gary
  • 24,440

9 Answers9

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.

Glorfindel
  • 3,167
Inaimathi
  • 4,874
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.

Cyclops
  • 2,167
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!!

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.

Frank Shearar
  • 16,751
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!

Jason Lewis
  • 2,113
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)

Orbling
  • 5,686
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.

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.

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...

glenatron
  • 8,689