merits of Lisp vs Python

greg greg at cosc.canterbury.ac.nz
Fri Dec 15 06:18:13 EST 2006


Ken Tilton wrote:

> So this:
>     (defmethod tf-reverse (id (eql ',sub-id)) resx (drv-opnds tf drv))
>         , at reverser)
> 
> becomes this:
> 
>     (defmethod tf-reverse ((id (eql ',sub-id)) tf drv
>                         &aux (opnds (drv-opnds tf drv)))
>        (loop for resx in (results drv)
>          , at reverser))

I don't see why you can't just write a function that
loops over the results and calls the user's reversal
function for each one.

   def reverse_multiple(skill, resx_list, opnds):
     for resx in rex_list:
       skill.reverse(resx, opnds)

There's no need to macro-expand this code into every
reversal function, when it can be done once as part of
the framework that calls the reversal functions.

--
Greg



More information about the Python-list mailing list