Cooking with Lisp

Another blog about Lisp, the world's greatest programming language.

Friday, July 29, 2005

Public Thanks for the Movies

I want to publicly thank Marco Baringer and Rainer Joswig for the recent movies they've provided lately. I think they're great demos for someone starting out or for showing someone interested in Common Lisp.

I had a non-Lisper watch Rainer's movie on DSL creation and he certainly came away pretty impressed by how fast and easy it was to do what Rainer demonstrated.

I really want to thank Marco for providing such a full-featured demonstration of SLIME. A lot of people starting out in Lisp don't quite get how to manage the minute-by-minute development tasks of editing code, debugging it, looking up documentation, etc. Especially debugging. I remember when I started out in Lisp a long time ago, it was really hard for me to wrap my head around what the debugger was really trying to tell me and how to effectively use it. Marco does a great job of showing how to use the SLIME debugger.

I think that just about everyone can learn something about SLIME that they weren't aware of. Even though I was aware of them, I came away with a better awareness of the cross referencing tools, as I never really bothered to learn how they work.

Once of the interesting things that Marco shows is his use of structured editing, that is, '(' creating balanced parens and ')' moving past the closing paren. He discusses this in his Editing Lisp Code in Emacs page on CLiki (which is a very helpful guide if you haven't read it yet) and I remember trying those before and not really being happy about how it worked, but seeing how it worked in the video, I'm going to try them again.

w3m Customization

From watching Marco's slime movie yesterday, I noticed that he's using w3m for browsing HyperSpec pages from within Emacs. I've been doing that as well for about a year and found a couple of w3m settings that make it a bit nicer:

(setq w3m-symbol 'w3m-default-symbol)

w3m-symbol isn't set to w3m-default-symbol by default. With out of the box settings, HyperSpec pages get those weird box characters at the top of the page, as seen in Marcro's movie. That's caused by some encoding between character sets, as w3m is Japanese based software, so it's got Asian encodings set by default. Setting this to w3m-default-symbol makes it look nicer.

(setq w3m-key-binding 'info)

This sets the key bindings to match closer to what info-mode uses, which at least for me, my brain prefers to use from within Emacs. The other option for this is a Lynx mode setting, so you may want to try that if you're familiar with it.

Both of these are customizeable variables, so you don't need to actually setq them.

I find w3m to work really well for documenting Lisp. HyperSpec looks good, CLtL2 looks good, Practical Common Lisp looks good. It's real simple to use bookmarks in w3m, just hit 'a' and the page will be added, 'v' shows you the bookmarks, and 'e' allows you to edit the page w3m is viewing (including the bookmarks page). Bookmarks have decent organization to them and it's relatively easy to edit them to organize them better.

Thursday, July 14, 2005

People learning Lisp today have it so much easier

Paul McJones' History of Lisp has been blogged before (here, here, here, and here), but it keeps getting new content. It's gotten PDFs of 3 early Lisp books from the 1960's, chronologically:

Lisp 1.5 Programmer's Manual (1962) (the year I was born)
The Programming Language LISP: Its Operation and Applications (1964)
LISP 1.5 Primer (1967)

I had read all of them in 1980 when I entered college and went scouring through the university's library for any books on Lisp. I've got the first two, as Amazon still sells the Programmer's Manual new and the second book you can get used.

Modern day Lispers should definitely take a look at these and see how much the language has changed.

Especially take a look at "Lisp 1.5 Primer". This was what I actually learned Lisp from. The horror. It starts off with a couple dozen pages on dotted notation, there's no quote reader macro, you don't start defining functions until page 66 or so, and factorial doesn't get defined until page 96. It took a lot of effort to wade through all of that. I remember trying to code up some of the examples in some weird Lisp 1.5 variant that was on the PDP-11/70 at the time, which was different enough from "real" Lisp 1.5 to make the process exceptionally painful.

But look at that second book and be amazed at how much people got done with Lisp 1.5 in the early 1960's, and remember that they didn't have Emacs at the time, they punched this all in on paper cards and submitted them to the mainframe. Imagine trying to get the number of closing parenthesis right for an expression many cards back. Some of the programs are advanced even for today, although we would implement them far differently today. Those pioneers in the 1960's didn't shy away from the hard problems because they didn't have a fancy IDE with syntax coloring or auto-completion. Note that you may have heard of some of the contributers: Daniel G. Bobrow and L. Peter Deutsch (who was only a teenager when he wrote the implementation for the PDP-1).