merits of Lisp vs Python

Bill Atkins atkinw at rpi.edu
Wed Dec 13 00:02:00 EST 2006


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:

> Pascal Costanza <pc at p-cos.net> writes:
>> May you have tried the wrong Lisp dialects so far:
>> 
>> (loop for i from 2 to 10 by 2
>>        do (print i))
>
> The loop language is so complicated and confusing that I never
> bothered trying to learn it.  I always used simpler primitives to
> write loops and it was always enough.

I think you're missing out.  If you don't find LOOP appealing, look
for the ITERATE package.  ITERATE is a more Lispy, more extensible
replacement for LOOP.

>> This is Common Lisp. (Many Lisp and Scheme tutorials teach you that
>> you should implement this using recursion, but you really don't have
>> to. ;)
>
> You can't really use that much recursion in Lisp because of the lack
> of guaranteed TCO.  I think that makes it reasonable to say that
> Scheme is a functional language but Lisp is not.  ("Functional" = it's
> reasonable to code in a style where the only way to connect variables
> to values is lambda binding (maybe through syntax sugar), so all loops
> are implemented with recursion).

You should be pragmatic about this - I have never used a CL
implementation that didn't do TCO optimization (indeed, are there
any?).  Although the standard doesn't require it, I treat it as a de
facto requirement and don't worry too much about it.



More information about the Python-list mailing list