Python and Lisp

Ted points out this essay intended to help Lisp dudes understand Python.

“Python supports all of Lisp’s essential features except macros, and…”

… so what’s the point? Why are people so deeply suspicious of programing languages that provide solid tools to construct the program prior to compiling it? The language designers seem to feel that programmers shouldn’t be allowed such tools. “Oh no son, you might hurt your self.” The programmers fallen for this – “Right you are boss! Oh, could you shapen this stick for me, please?”

For example here is an optional package in Common Lisp written so that it adds an amazingly powerful bit of functionality. It allows you to write programs where functions appear to generate a series of values. A suite of functions are provided to do things with these series such as generate, filter, compose them. This is very analagous to to the pipes of unix or similar constructs found in servers.

But the important point is that this package conspires to rewrite the programs written in this functional notation into more traditional programs using loops. This rewriting is made possible because Lisp provides the tools to pick up your program at compile time chew on in and put it back down again before diving into the compiler; i.e. macros.

This allows you to both to create micro-languages (or not so micro like the one above) that are problem specific. For example if you want a parser you don’t need to invent a separate program like yacc to generate parsers you can do it in the native language.

Syntax is not as important as ablity to revise the parse tree. It’s incredibly sad watching the industry slowly but surely re-discover all the features in Lisp. One at a time usually about one a year.

Leave a Reply
