Why I like lisp

November 4, 2009 at 12:18 pm | Posted in Uncategorized | Leave a comment

I get a lot of programmers ask me why I am so gung-ho over lisp. Hal Abelson, one of the authors of Structure and Interpretation of Computer Programs, wrote this in the preface to Simply Scheme. I couldn’t have stated it better myself:

One of the best ways to stifle the growth of an idea is to enshrine it in an educational curriculum. The textbook publishers, certification panels, professional organizations, the folks who write the college entrance exams–once they’ve settled on an approach, they become frozen in a straitjacket of interlocking constraints that thwarts the ability to evolve. So it is common that students learn the “modern” geography of countries that no longer exist and practice using logarithm tables when calculators have made tables obsolete. And in computer science, beginning courses are trapped in an approach that was already ten years out of date by the time it was canonized in the mid 80s, when the College Entrance Examination Board adopted an advanced placement exam based on Pascal.

. . .

Harvey and Wright’s introduction to computing emerges from a different intellectual heritage, one rooted in research in artificial intelligence and the programming language Lisp. In approaching computing through this book, you’ll focus on two essential techniques.

First is the notion of symbolic programming. This means that you deal not only with numbers and letters, but with structured collections of data–a word is a list of characters, a sentence is a list of words, a paragraph is a list of sentences, a story is a list of paragraphs, and so on. You assemble things in terms of natural parts, rather than always viewing data in terms of its tiniest pieces. It’s the difference between saying “find the fifth character of the third word in the sentence” and “scan the sentence until you pass two spaces, then scan past four more characters, and return the next character.”

The second technique is to work with higher-order functions. That means that you don’t only write programs, but rather you write programs that write programs, so you can bootstrap your methods into more powerful methods.

These two techniques belong at center stage in any beginning programming course, which is exactly where Harvey and Wright put them. The underlying principle in both cases is that you work with general parts that you extend and combine in flexible ways, rather than tiny fragments that you fit together into rigid structures.

You should come to this introduction to computing ready to think about ideas rather than details of syntax, ready to design your own languages rather than to memorize the rules of languages other people have designed. This kind of activity changes your outlook not only on programming, but on any area where design plays an important role, because you learn to appreciate the relations among parts rather than always fixating on the individual pieces.

Programming C is kinda like making a machine with interlocking gears. If one of the gears is off, the whole thing doesn’t work. But as long as it is programmed correctly, it functions like clockwork.

Lisp, on the other hand, works kinda like a biological ecosystem. Groups of simple units (cells) can be grouped and organized a certain way can create insanely complex systems (humans) with relative ease. It’s hard to do this in C because the gearwork becomes too complex.

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: