Tuesday, March 3, 2009

I hate Lisp

It was 1981 and I was taking my first real computer course at Harvard. I was rapidly discovering that *real* programming sucked. Big time.

My parents had scraped up enough money to get me a TRS-80 Model 1 in high school. My friend Andy showed me how to write Z80 assembly code. It was so much more powerful than BASIC. It gave you direct access to the hardware and it was lightning fast. I had a lot of fun with it.

When I went to college, I decided to try computers and astronomy (those being my big interests at the time). The computer course was taught on a PDP-11 and we started off with Macro-11 assembly code. I remember being amazed that you could program in assembly code on time-shared machine and not bring the entire thing crashing down.

The textbook was “An introduction to computer programming and data structures using MACRO-11” by Harry Lewis. It seemed ok, but I didn't care for it's high-handed ‘principles of programming’ that were sprinkled throughout the book. For example,
Symmetry Principle: Programs should be symmetric and uniform when performing similar functions, unless there is good reason to the contrary. Extreme Value Principle: Programs should work correctly for all data on which they may operate.
I especially hated this one:
Un-Cuteness Principle: Don't be clever or cute in an attempt to save a few memory locations or a few microseconds.
Isn't that at least half the fun of assembly language programming?

The first few weeks of the course involved programming such tasks as finding elements in a table, dereferencing pointers, and sorting. Whee! We learned how to edit programs on a line printer(!) using TECO(!!). Eventually someone took pity on me and showed me how to use vi.

In the middle of the course we started learning about a new language: Lisp. We started learning how Lisp was implemented in Macro-11. It was idiotic. Lisp apparently had no notion of ‘memory’ at all, let alone data structures like strings or tables. Everything seemed to be assembled out of long, long chains of pointers, and the Macro-11 programs we wrote spent most of their time rummaging around these pointer chains trying to find *some* data *somewhere*. We wrote routines in Macro-11 that did MEMQ and ASSQ and GETPROP (for some weird reason Lisp had these ‘symbols’ that had ‘properties’, but it sure was a chore to get at the properties).

Furthermore, it seemed that Lisp encouraged the use of really inefficient coding practices. It was often the case that our subroutines would call other subroutines or even call themselves. I had no conceptual problem with a subroutine calling itself (except that it was a blatant violation of the all important ‘Un-Cuteness Principle’), but every function call ate up a chunk of stack, and that put a limit on how many function calls you could do.

It was obvious to me that Lisp was invented by some bozo that clearly didn't understand how computers actually worked. Why would someone lookup a value in a property list when you could write a simple routine in Macro-11 that would find the value in a table? The assembly code was much faster, the table was much more compact, and you could avoid these endless chains of pointers. Assuming you were dumb enough to put your data in a property list, you really couldn't use a very big property list without worrying about the stack depth. This just wasn't an issue with a linear table in assembly code.

I got this impression of Lisp: far slower than assembly, far harder to understand, far less efficient, and far less capable. I hated it and was glad to be rid of it when I finished the course.

13 comments:

Xach said...

That's pretty funny. I hope it's the first in a series.

I wonder how typical your first experience was, and how the typical first Lisp experience is different today vs. 20 years ago, what with the prominent new books, success stories, failure stories, etc.

Amit said...

Interesting. I learned Scheme a bit later than you learned Lisp, but I had the opposite reaction: Scheme seemed closer to the (register) machine than C, and it seemed like a nice alternative to assembly language.

Rich said...

I had already a lot of OO experience with C++ and Java by the time I was first exposed to Scheme. I was going back to school to get an actual degree in CS. The required intro to computer science course was taught in Scheme.

Bottom line, I hated it. Hated it, hated it hated it. By the end of the semester, I had come to terms with the language, but I still thought it was silly.

Then I spent the next two semesters TAing the same class. Over that year, I slowly developed a grudging respect for Scheme and Lisp, and eventually grew to love them.

steck said...

My first college programming course
used PL/I (at Brown, with Andy van Dam).
I thought programming was kind of fun,
but not the sort of serious activity
one should devote time to in college.

I didn't really program again for another
12 years.

-- Paul

Darren said...

I didn't take the collage route, I started coding out of school, my first projects were written in assembler on z80 machines, I have been coding for 30 years, I found lisp 6 years ago, I'm very sad I didn't learn it earlier.

As seems to be the way, as an outcast I try to evangelize, I have so far turned 3 people to the dark side, 2 learned lisp in collage, and didn't see the point to go back, but now understand the point.

I think I'm a smart guy, in the areas I have worked I have worked for the top companies, I even did a stint at the evil software place. it took me around 2 years to get it, now I use lisp when ever I can.

Daniel Tenner said...

Beautiful troll. Love it :-)

TheArthur said...

Some Lisps suck... some don't and someone hates each of them. Lots has changed in the last 40 or so years of Lisping. Its good to hear about 'the good old days' because modern lispers coming from VB or Java are likely to not even notice the fact that lisp uses lots of pointers.

Javi M said...

Regarding LISP and pointers: I guess LISt Processing was not obvious enough for some people ;-)

In any case, LISP like most functional languages seem a bit foreign to a lot of people. I did not appreciate LISP until I started figuring out, how with a couple of lines in LISP... I could achieve the same result that required an order of magnitude (or more) of extra code in procedural languages.

spongefrob said...

I love oranges. Mm mm good. Boy o boy, do I love oranges. they are so... so... orange-y.

Somebody once gave me an apple... I hate apples. You know why? 'Cause they're not ORANGES!! Stupid fricken not-orange thingies...

Whoever it is that invented Apples doesn't know A THING about inventing oranges... and we hatess itss precious...

Patrick X said...

When I first came across lisp I just love it. Cute story though ^_^

La fourmi said...

Each time you use "CAR" and "CDR" in Lisp, you actually refer to IBM 70x register acess... pretty close to the hardware actually ! :-)

gvb said...

In C, you are writing assembly constructs disguised as a high level language.

In lisp, you are writing compiler constructs (abstract syntax trees) disguised as a high level language.

Assembly language targets hardware-oriented geeks. Lisp targets compiler-oriented geeks. Since the two don't (generally) understand the other's viewpoint, each hates the other's favorite language.

Murat Ozgur Kaymakci said...

funny post ;) thank you