Hackers and Painters and Lisp

Started by
4 comments, last by GameDev.net 18 years, 3 months ago
Hi, I just finished reading the book Hackers and Painters and it really has sold me out on lisp. I've never seen or used lisp before and was wondering if anyone here uses it. Would you say it is beneficial to better understanding programming by learning this language? I dont care if i cant program commercial apps with it, even though i know you can but, i am more interested in becoming a better programmer and really want to know what this lisp enlightenment is all about. What is the number 1 realization using lisp gives to a programmer? I know thats a bit of an abstract question but would be interested in your opinions. Thanks :)
Advertisement
Quote:Original post by one mind
Hi,

I just finished reading the book Hackers and Painters and it really has sold me out on lisp. I've never seen or used lisp before and was wondering if anyone here uses it. Would you say it is beneficial to better understanding programming by learning this language?

Yes, I would. It lets you see a different way to think of things.

Quote:I dont care if i cant program commercial apps with it, even though i know you can but, i am more interested in becoming a better programmer and really want to know what this lisp enlightenment is all about.

Sure you can program commercial applications in it. What would stop you?

Quote:What is the number 1 realization using lisp gives to a programmer?

Hmm. Probably that, in Lisp, code and data are basically represented in the same way. This is more useful than it might sound.

The best way to understand the answers to your questions is to learn Lisp.
Clicky

Judging from the little I've seen of it I'd say it's a very interesting and unique language.
I don't know if I've experienced the Enlightenment yet, but I've definitely learned a lot through lisp/scheme. I started with an old copy of the Little Lisper, which went a long way to helping me grok recursion.

Macros are very neat, and after learning to how write code that writes code, C++'s template system makes a lot more sense.

Actually a lot of the wacky pseudo-functional template acrobatics you see in Boost makes sense after learning lisp.

Lisp is good at opening your eyes to different paradigms of programming. The Common Lisp Object system is ugly but very powerful (much more so than C++/Java object model). I didn't realize how crippling single-dispatch was until I read about CLOS.

Hmmm..I think that's it, but I'm still new, with much learning ahead. Next "Aha!" moment is hopefully going to be continuations, which have thus far evaded my understanding.

-Alex


Once you know the basics of Lisp (you can learn them in an evening), read Graham's "On Lisp". It's freely downloadable from his website. The main point in Lisp is that with it you can create almost any conceivable abstraction. Whereas in most programming languages, you create abstractions by using the features given you in the language, e.g. functions and classes. This obviously restricts what you can do. And so in most languages, you end up having "patterns" which give you directions on how to structure your code to achieve something more "complex". I.e. you want to do something, and the pattern is how you achieve that something with e.g. classes. In Lisp, you can create a new abstraction which encapsulates the pattern. When you use this abstraction, you won't have any support code, only the beef.

As a simple example, suppose in C you almost always iterate over some range of integers like this:
for (int i=0; i <
Let's try that again..

Once you know the basics of Lisp (you can learn them in an evening), read Graham's "On Lisp". It's freely downloadable from his website. The main point in Lisp is that with it you can create almost any conceivable abstraction. Whereas in most programming languages, you create abstractions by using the features given you in the language, e.g. functions and classes. This obviously restricts what you can do. And so in most languages, you end up having "patterns" which give you directions on how to structure your code to achieve something more "complex". I.e. you want to do something, and the pattern is how you achieve that something with e.g. classes. In Lisp, you can create a new abstraction which encapsulates the pattern. When you use this abstraction, you won't have any support code, only the beef.

As a simple example, suppose in C you almost always iterate over some range of integers like this:
for (int i=0; i < 100; i++) {body}
for (int e=10; e < 50; e++) {body}

In Lisp, you could make a macro for-range and then do:
(for-range i 100 body)
(for-range e (10 50) body)

This contains the minimal amount of information needed. Of course, the savings aren't that great in this example since the C code wasn't that long either.

This topic is closed to new replies.

Advertisement