Peter Christensen

  • Presentations
  • Contact Me

How To Learn Lisp

March 3, 2008 by Peter 42 Comments

In the spirit of my last post, I decided to turn one of my favorite long comments on Hacker News into a blog post in the hopes that someone would find it useful. There was a good discussion last week about how to learn Lisp, and since I was a little late to the thread, most of the things I wanted to say had already been said. So, in an effort to pull it all together, I made a nice long summary comment, which is reproduced and cleaned up below.

Before I started learning Lisp, I have (in reverse chronological order) worked with .Net for several years, disliked C++ in college, loved Pascal in high school, dabbled in (Assembly?) programming my TI-82 graphing calculator, and started with Hypercard. Here’s my advice based on ~1 year of part-time Lisp education.

  • To learn “lispiness”, functional programming, and get a feel for the computational approach to programming, read The Little Schemer and The Seasoned Schemer. Also, use the resources for the MIT Intro course Structure and Interpretation of Computer Programs. Watch the video lectures (30 well spent hours) and if you’re ambitions, read the book (Amazon). Doing these things will help keep you from writing PHP in Lisp.
  • To put it into practical perspective and learn the nuts and bolts of modern common Lisp, read Practical Common Lisp (Amazon).
  • If you read PCL, you will run into Emacs and SLIME (the generally preferred [NO FLAMES, PLEASE. I KNOW VI IS AWESOME TOO] open source way to edit Lisp files). I wrote some resources to help with that:
    • Emac/SLIME Cheat Sheet
    • Commentary on the SLIME screencast
  • I’m surprised no one has mentioned PAIP (Peter Norvig’s Paradigms of Artificial Intelligence Programming). Probably because there’s no free version online and it’s a pricey book. I got it for myself for Christmas and it’s well worth the price. It’s half AI book, half tutorial on Lisp programming and Lisp style. It’s a good read with lots of example programs written in good Lisp Style.

There are three hurdles people usually run into when learning Lisp:

  1. The language looks different – this goes away with practice and familiarity. It starts looking normal fast. The parentheses are a bit tough to manage unless you use a capable editor, which leads to:
  2. Emacs is different – really powerful, fun to use, but it takes investment in learning. It’s really tempting to quit when starting, but worth getting over the hump. Once you do that:
  3. The way of thinking is different in Lisp – Lisp seems a little awkward to use until you get (don’t need to master them, just get the idea) the following ideas: 1) code can be manipulated as data because the syntax is so simple, 2) creating your own syntax (using macros – code that writes code) means that you can express your program in a way that closely matches the problem you’re trying to solve. Some good articles to help get these points are:
    1. The Nature of Lisp
    2. Functional Programming For The Rest of Us

Don’t worry if you don’t get these “big picture” things at first, they click at some point and everything makes a lot more sense. You can speed that up by putting a lot more Lisp in your head in the meantime.

Does anyone have any more tips on learning Lisp?

Also: read comments on this post at comp.lang.lisp, reddit, Hacker News

 

Filed Under: Education, Lisp

Lisp is Great Because It’s An Ordinary Language

February 27, 2008 by Peter 5 Comments

Kenny Tilton just wrote a great article that I think cuts through a lot of the clutter that gets spoken about Lisp. Among the great quotes in the article, he says:

“The first reason you should be using Lisp is a non-reason, an answer to an objection, a negation, a let-down: Lisp is just an ordinary programming language.”

and

“Lisp at one level of understanding is just a normal high level programming language. Those parentheses look quite different but constitute only a superficial difference from the conventional chicken scratch syntax of semi-colons, braces, full stops, and brackets. When a conventional programmer sits down to program Lisp, they feel quickly at home: Lisp is just another 3GL.”

“I feel terrible about this. I am supposed to be up on a soapbox preaching eternal salvation and ecstasies glorious and unknown”.

I couldn’t agree more. While I haven’t officially taken the Road to Lisp survey, I will say that I started out by reading Paul Graham’s essays, which sparked my interest but didn’t convince me to ask. Paul is an honest, straightforward, persuasive writer, but in a world where everything is overhyped and “The Greatest, Most Extremest X EVER!!!!!!” I looked for some more confirmation before taking him at his word. Well, I found it. Not in any specific place, but in the sum of a year of experience reading reviews, comments, history, blogs, and books, and doing some programming of my own. And the answer I came up was that Lisp is simply a great general purpose language. And since everyone else has the same wariness about any “Most Extremest EVER!!!!”, I think Kenny can close sum it up better:

“Lispers are accused of religious fanaticism and zealotry — nope, our enthusiasm is all about getting applications built faster with less pain.”

Amen.

Filed Under: Lisp

Public Beta Open For “Ultimate N00b SLIME/Emacs Cheat Sheet”

February 14, 2008 by Peter 28 Comments

On this Valentine’s Day, give the gift people really want – complex key chords!

In other news, I’ve got fans!

Well, at least one anyway. A lot of the feedback I’ve received on this site so far has been from experienced Lispers who appreciate my enthusiasm and contributions for new users. Yesterday, I got the first (I think) comment and reply from another new Lisper who’s actually getting some use out of my stuff. Aaron Feng wrote up my SLIME movie reference, and he even caught my later reference to my upcoming “Ultimate N00b SLIME/Emacs Cheat Sheet”. Well Aaron, wait no more!

I’ve been using it for a week or so, and I’m sort of pleased with it. First the positives:

  • It includes all of the SLIME commands from the SLIME manual
  • It includes all of the Emacs commands from the built in tutorial
  • It includes the main Emacs help keys
  • The commands are sorted and grouped by functional area
  • It’s all fits on one page

Here are some of the things I’m not so pleased with:

  • It has very few Emacs commands, relative to what’s available
  • It doesn’t include any advanced text manipulation options
  • It doesn’t have the sexp-based manipulation commands. I couldn’t find standard bindings for these and I’m not up to Emacs tweaking yet. Adding a key for the slime-selector was enough for me at this point.
  • It’s pretty crowded (~100 commands and descriptions on one page)

The Emacs section is weak mainly because I haven’t dived into Emacs the way I have into Lisp/SLIME. I figure for now I can use it as a standard, powerful IDE for writing, testing, and debugging Lisp, and I can add Emacs wizardry later. I think I hit the point of diminishing returns where focusing on my tools will help me learn to code in Lisp. Now I need to get my coding up to par with my tools! I need to improve to the point where it’s worth getting a copy of Learning GNU Emacs.

So without further ado, here is my unfinished yet eminently usable cheat sheet:

[NOTE: These links were broken for a while. They work now]

Ultimate N00b SLIME/Emacs Cheat Sheet (pdf)

or customize your own!

Ultimate N00b SLIME/Emacs Cheat Sheet (xls)

Enjoy! As usual, feedback is appreciated. If you’ve got an Emacs trick that you use a jillion times a day that you think a new user could use, this is a great way to share!

(PS I hope it goes without saying but there isn’t any kind of beta process. Just that I consider it a work in progress and that it will definitely change in the future, hopefully in response to useful criticism.)

Follow the discussion at: Hacker News, programming.reddit.com, comp.lang.lisp, comp.emacs

 

Filed Under: Lisp, Programming

Reference for the SLIME/Lisp/Emacs Screencast

February 8, 2008 by Peter 17 Comments

Following up on my transcript/review of the UCW “Hello World” screencast, here is my review of Marco Barringer’s SLIME movie. (Description, 150MB .mov, Torrent, watch online). This screencast was more difficult to annotate because:

  1. It was almost 3x as long (55 min vs. 20)
  2. It covered more topics (Linux, Emacs, Lisp, SLIME)

I did find it much more interesting though because it showed off a lot of the cool features in those topics, whereas the UCW screencast was mostly just instructional. Also, I don’t know if I’ll ever use UCW for an app, but I’m already using the LELS stack and plan on using it for a long time to come.

(See what other people have said about it)

Looking back at my UCW reference, I think the format worked for that screencast because it was mostly just straight Lisp code. In the SLIME movie, the Lisp code is the least useful part – it’s just the vehicle for showing off the tools. So there’s a mix of Linux commands (unfortunately omitted because WordPress or Apache or somebody thinks they’re a security problem), Emacs key chords, Emacs Lisp code, and Common Lisp code. I’m leaving out most of the Common Lisp code for the morse code translator to focus on what’s more relevant. Also, I added links to documentation for the features shown. Hopefully this will make it easier to watch the movie and get straight to work on your own projects!

[Read more…]

Filed Under: Lisp

Transcript of Marco Barringer’s UCW “Hello World” Movie

January 31, 2008 by Peter 2 Comments

I think one of the things that made Ruby on Rails so popular was the screencasts where you could write a blog site in 20 minutes, integrate with Flickr in 5 minutes, or setup database migrations in 20 minutes. It’s hard to overstate how mindblowing those were in 2005 (or whenever they came out). At that point, the only languages I had ever used were Pascal, C, C++ (all in school) and C#/.Net (in jobs). I was used to (and blind to) the big, industrial scale, industrial pain in the butt that those languages consist of. Ruby on Rails just seemed to dance, seemed so easy and flexible. I didn’t ever end up getting into RoR, but interest in it did start me on the language learning, abstraction seeking path I’m on today.

Lisp happens to have a number of similar screencasts. I’ve looked at a couple of them, both by Marco Barringer. I watched the first half of the SLIME movie and was blown away (I only watched the first half because 3:30am isn’t a great time to stay awake through a screencast). He was just throwing out tricks right and left: Linux tricks, emacs tricks, slime tricks, Lisp tricks. I kept rewinding and rewatching parts, like a bunch of Cub Scouts trying to figure out how a magician makes a handkerchief disappear. I have installed and played with emacs and SLIME, but I didn’t get the gist of what it could do. Everyone said it’s so powerful, and I believed them. They said it was extensible and reprogrammable, but I’m not ready to take on that. I tried looking at the documentation, but everything is presented so evenly that I couldn’t get a sense of where to start. I decided that the SLIME movie was too good of documentation to be stuck inside a non-search-indexable video format, so I re-downloaded it and started watching it, frequently pausing and taking meticulous notes on key chords, exact times that different things happen, and setup commands, with the intention that the lessons it contains could easily be referred to later. Well, I had to stop that because my download is corrupted, I only have the first 8 minutes, and right now the download link isn’t working. So I moved on to the next video (which was actually the first video), the UCW “Hello World” screencast (download 51MB .mov or torrent).

In this 20 minute video, Marco created a simple website using UCW, the UnCommon Web application framework (that Marco created). The focus was teaching how to write a simple site and what each of the commands and components means, so it was a little slower and had less “zing” than the RoR screencasts, which just demonstrated how quick it was to work with without waiting for you to figure out what’s going on. Also, since it was focused on the basics of UCW, it didn’t give a good feel for how powerful UCW actually is. I think it would be a great Part I in a series of screencasts showing the progression to use more and more of the power of the framework. Regardless, I have my notes anyway. I haven’t done any special formatting or cleaning up. I plan on doing this for more of the Lisp movies and I’ll wait until I’ve found a style I like, then go back and clean them up. The only thing special is that actual Lisp code is marked with “—” on the lines immediately above and below it. Here goes:

[Read more…]

Filed Under: Lisp

Best Quote About Lisp (That’s No Longer Valid)

January 21, 2008 by Peter 2 Comments

As part of my year’s learning goals, I’ve started reading Peter Norvig’s Paradigms of Artificial Intelligence Programming. I’ve gotten through the first few chapters (introductions to Lisp and a small sample program), and so far it’s a great book. Now, since I’m a cover-to-cover kind of guy, I even read the introduction, and I’m sure glad I did. There’s a great money quote that I’ve never seen anyone reference that is so self-explanatory I’ll just shut up and quote it:

“There is a myth that Lisp (and Prolog) are ‘special-purpose’ languages, while languages like Pascal and C are ‘general purpose.’ Actually, just the reverse is true. Pascal and C are special-purpose languages for manipulating the registers and memory of a von Neumann-style computer. The majority of their syntax is devoted to arithmetic and Boolean expressions, and while they provide some facilities for forming data structures, they have poor mechanisms for procedural abstraction or control abstraction. In addition, they are designed for the state-oriented style of programming: computing a result by changing the value of variables through assignment statements.”

“Lisp, on the other hand, has no special syntax for arithmetic. Addition and multiplication are no more or less basic than list operations like appending, or string operations like converting to upper case. But Lisp provides all you will need for programming in general: defining data structures, functions, and the means for combining them.”

This is like the statement in the Preface of the Structure and Interpretation of Computer Programs:

“Underlying our approach to this subject is our conviction that ‘computer science’ is not a science and that its significance has little to do with computers. The computer revolution is a revolution in the way we think and in the way we express what we think. The essence of this change is the emergence of what might best be called procedural epistemology — the study of the structure of knowledge from an imperative point of view, as opposed to the more declarative point of view taken by classical mathematical subjects. Mathematics provides a framework for dealing precisely with notions of ‘what is.’ Computation provides a framework for dealing precisely with notions of ‘how to.'”

I had read the SICP quote before and knew it was important, but Norvig’s quote made it clearer for me.

Fortunately, the gulf between programming languages isn’t as great as it was in 1992 when PAIP was published. While languages like C and C++ are hard to beat for performance and OS interaction, newer languages like Python and Ruby (and even Java/C# with garbage collection) deal more with computation than direct hardware manipulation. Fortunately they haven’t followed Lisp in all ways!

Filed Under: Lisp

Thanks Again, McCarthy

January 21, 2008 by Peter 1 Comment

I’m up at night watching Ice Age 2: The Meltdown and in the special features, there are set of fake 50s style documentaries on the different animals in the movie. The first one is called:

Sloths: Natures Loveable Lisper

Thanks to a wonderful naming idea from 50 years ago, we have a mascot:

sid

I don’t know about you, but I’m just a little less proud than I was 5 minutes ago. How about this?

sid mccarthy

There, I feel a little bit better. A note to all aspiring computational revolutionaries: ask a normal person what your great language name makes them think of. You might be surprised what you find out.

Of course, I think this lesson has been well learned because all of the new languages have cool names. Thankfully, this is one way that new languages are not becoming more like Lisp!

Filed Under: Fun, Lisp

Responses to Lisp: The Golden Age

January 16, 2008 by Peter 6 Comments

I’m overwhelmed at the response to my recent article about Lisp: The Golden Age Isn\’t Coming Back, Let\’s Welcome a Bright Future! It clearly shows my blogging virginity that I’m excited about 4,000 page views, but that doesn’t make me any less excited! Not only that, there have been lots of good comments, almost 100 total, on this site, programming.reddit.com and Hacker News. I’d like to address some of the comments and criticisms in one place, here, rather than all over the place.

First, my mindset and perspective were poorly communicated and set the wrong stage going into the article. (I hate putting “WARNING” tags at the beginning of posts to set the right context, even though they are so useful!) A lot of people thought I was just another noob complaining about how hard it was to use Lisp. I mean, I guess I sort of was, but that wasn’t the point. The point was that Lisp has barriers to becoming a more popular, mainstream language, and every one of them is tractable! Here are a couple of the points, along with the solutions:

[Read more…]

Filed Under: Lisp

Lisp: The Golden Age Isn’t Coming Back, Let’s Welcome a Bright Future

January 14, 2008 by Peter 20 Comments

I am a fairly new member of the Lisp community, so new that most people have never heard of me. I’m one of the young programmers that have read the excellent writing from Paul Graham, Raganwald, and Steve Yegge and decided to try Lisp out for myself. I’ve had much more time available in small chunks, enough to read tutorials and articles on the internet but not enough to dive into heavy programming. As a result, I’ve gotten to know the community and history better than the language and tools, probably better than any new convert. Here are some observations I’ve made (summary then detail):

  1. Lisp is like a new language with lots of praise from important people.
  2. Lisp used to be very important but lost that position.
  3. Lisp lacks the infrastructure to get new users running quickly. The tools are there but they aren’t organized and streamlined.
  4. The Lisp community is fractured but composed of enough good people that it could develop into a positive, influential force.

[Read more…]

Filed Under: Lisp

Technology Decisions – Where to Invest Your Brainpower

January 9, 2008 by Peter 4 Comments

(note: inspired by this post at SecretGeek)

(note #2: SecretGeek found this fantastic post by the greatly missed Kathy Sierra)

Anyone who spends 5 minutes reading technology news sites knows that there is FAR too much for any one person to learn (there’s almost too much for one person to be aware of). Between big companies, startups, open source, and research, there are thousands of new products, libraries, languages, technologies, etc every year. Thinking you’ll learn all of them (or even a significant fraction of them) is just madness. So here’s the process I’ve used to evaluate things.

[Read more…]

Filed Under: Education, Lisp

« Previous Page
Next Page »

Categories

  • Blog
  • Book Review
  • Business
  • Clojure
  • Education
  • Emacs
  • Fun
  • iOS
  • Lisp
  • Personal Sprints
  • Pictures
  • Polyphasic
  • Presentations
  • Programming
  • Rails
  • Startups
  • Uncategorized

Copyright © 2025 · Minimum Pro Theme on Genesis Framework · WordPress · Log in