merits of Lisp vs Python

Andrew Reilly andrew-newspost at areilly.bpc-users.org
Thu Dec 14 05:18:23 EST 2006


On Thu, 14 Dec 2006 04:06:26 -0500, Ken Tilton wrote:
> Ken Tilton wrote:
>> Andrew Reilly wrote:
>>> However, in this particular instance, I'm inclined to wonder why
>>> meta-programming is the right answer, rather than just doing all of the
>>> interpolation and what-not at run-time, based on a big table of your
>>> algebra rules? 
>> 
>> I am afraid I do not see what alternative you are suggesting. I 
>> especially do not see how interpolation is in play.
> 
> [Guessing pending your clarification] "Interpolation" does happen at 
> runtime. This not about the actually quite rare use of macrology to move 
> certain calculations to compile time, this is about getting dozens of 
> transformation-specifc rules written to fit into a larger mechanism (by 
> having the right arguments and returning the right kinds of results, 
> with a minimum of boilerplate and a maximum of resiliency in the face of 
> refactoring.
> 
> The reason I post macro expansions along with examples of the macro 
> being applied is so that one can see what code would have to be written 
> if I did not have the defskill macro to "write" them for me. I sugest 
> one start there, by comparing before and after.

Please pardon my woeful grasp of lisp: that's probably why I'm off-beam
here.  It seemed to me that the bulk of your macro-ified/templated version
was taking some text and a "reverse" operation and creating the methods of
an object, or generic functions or ??  Each skill seems to have a title, a
list of annotations, and a list of hints (and a reverse, which I don't
understand).  That all looks like data.  Couldn't you do that with a table
containing those fields, and key it off the defskill argument (or even the
title?) at startup?  Then you don't have to worry about re-factoring the
code: there's only going to be one piece of code, driven by a table.

I only mentioned interpolation because it seemed likely that you might
want to be mutating these strings to be more specific to what your student
was actually doing.  I didn't expect that "42" was necessarily the right
answer...

To back out a bit, here, and get back to the meat of the matter: if one is
using Python, then it's because one doesn't much care about performance,
and it's reasonable to do expansions, pattern matching and domain specific
language creation/use at run-time.  After all, that's how the language
itself works, mostly.

When one finds that one *does* care about performance, that doesn't leave
much wriggle room, though...

-- 
Andrew



More information about the Python-list mailing list