On-Lisp


On Lisp is Paul Graham's book on Common-Lisp macros (also known in some Scheme systems as DEFINE-MACRO). It is a very good ressource for learning those kind of macros, and features great discussions about the essence of Lisp.

The book focuses on extending Lisp to include nice amenities, by using macros. They're used to implement a wide variety of stuff, from small idioms to complete mini-languages for a given task. The goal is to adapt your language to the problem instead of adapting the problem to your language. It explains well what is meant by the following quote:

Lisp is a programmable programming language. (John Foderaro)

It is available online in multiple formats:

Note: To convert the texinfo document into a info readable document using Emacs, use the command:

makeinfo --no-split ol.texi ol.info

then add it to your dir file in your info directory.

Reviews:

JesperLouisAndersen

This is a very good book for anyone who wants to learn about programming scheme and lisp in general. It is more than just macros, being a sincere attempt from Paul Graham to write down his expertise. The book dispelled quite some common myths for me. Amongst these the ''language extension by macros makes the program harder to understand, since you need to understand all the macros first''-myth.

It starts out slowly, by handling function calls, lexical scoping, closures and the like. Around Chapter 3 higher order functions are introduced by the means of passing functions to functions. Then the return of functions is handled and he moves on to build a suite of utilities -- small functions which are general enough to be used all the time in every program one writes.

After a treatise on representing datastructures as functions (a very interesting concept, I initially learned to do in Standard ML), he begins to explain macros.

The macros he explain are the Lisp-variation; that is the unhygienic macros. I will continue my review when I have read those chapters ;)



category-texts