Python syntax in Lisp and Scheme

Kenny Tilton ktilton at nyc.rr.com
Sat Oct 11 21:26:39 EDT 2003



Alex Martelli wrote:
> Kenny Tilton wrote:
>    ...
> 
>>>The very 'feature' that was touted by Erann Gat as macros' killer
>>>advantage in the WITH-CONDITION-MAINTAINED example he posted is the
>>>crucial difference: functions (HO or not) and classes only group some
>>>existing code and data; macros can generate new code based on examining,
>>>and presumably to some level *understanding*, a LOT of very deep things
>>>about the code arguments they're given.
>>
>>Stop, your scaring me. You mean to say there are macros out there whose
>>output/behavior I cannot predict? And I am using them in a context where
>>I need to know what the behavior will be? What is wrong with me? And
>>what sort of non-deterministic macros are these, that go out and make
>>their own conclusions about what I meant in some way not documeted?
> 
> 
> Let's start with that WITH-CONDITION-MAINTAINED example of Gat.  Remember 
> it?  

No, and Google is not as great as we think it is. :( I did after 
extraordinary effort (on this my second try) find the original, but that 
was just an application of the macro, not its innards, and I did not get 
enough from his description to make out what it was all about. Worse, I 
could not find your follow-up objections. I had stopped following this 
thread to get some work done (and because I think the horse is dead).

All I know is that you are trying to round up a lynch mob to string up 
WITH-MAINTAINED-CONDITION, and thet Lisp the language is doomed to 
eternal damnation if we on c.l.l. do not denounce it. :)

No, seriously, what is your problem? That the macro would wlak the code 
of the condition to generate a demon that would not only test the 
condition but also do things to maintain the condition, based on its 
parsing of the code for the condition?

You got a problem with that? Anyway, this is good, I was going to say 
this chit chat would be better if we had some actual macros to fight over.

[Apologies up front: I am guessing left and right at both the macro and 
your objections. And ILC2003 starts tomorrow, so I may not get back to 
you all for a while.]

kenny

ps. Don't forget to read Paul Grahams Chapter's 1 & 8 in On Lisp, from 
now on I think it is pointless not to be debating what he said, vs what 
we are saying. The whole book is almost dedicated to macros. From the 
preface:

"The title [On Lisp] is intended to stress the importance of bottom-up 
programming in Lisp. Instead of just writing your program in Lisp, you 
can write your own language on Lisp, and write your program in that.

"It is possible to write programs bottom-up in any language, but Lisp is 
the most natural vehicle for this style of programming. In Lisp, 
bottom-up design is not a special technique reserved for unusually large 
or difficult programs. Any substantial program will be written partly in 
this style. Lisp was meant from the start to be an extensible language. 
The language itself is mostly a collection of Lisp functions, no 
different from the ones you define yourself. What’s more, Lisp functions 
can be expressed as lists, which are Lisp data structures. This means 
you can write Lisp functions which generate Lisp code.

"A good Lisp programmer must know how to take advantage of this 
possibility. The usual way to do so is by defining a kind of operator 
called a macro. Mastering macros is one of the most important steps in 
moving from writing correct Lisp programs to writing beautiful ones. 
Introductory Lisp books have room for no more than a quick overview of 
macros: an explanation of what macros are,together with a few examples 
which hint at the strange and wonderful things you can do with them.

"Those strange and wonderful things will receive special attention here. 
One of the aims of this book is to collect in one place all that people 
have till now had to learn from experience about macros."

Alex, have you read On Lisp?


-- 
http://tilton-technology.com
What?! You are a newbie and you haven't answered my:
  http://alu.cliki.net/The%20Road%20to%20Lisp%20Survey





More information about the Python-list mailing list