Python syntax in Lisp and Scheme

Sander Vesik sander at haldjas.folklore.ee
Sat Oct 4 18:22:12 EDT 2003


In comp.lang.scheme Grzegorz Chrupala <grzegorz at pithekos.net> wrote:
> jcb at iteris.com (MetalOne) wrote in message news:<92c59a2c.0310031345.57d20631 at posting.google.com>...
>> Scheme
>> (define vector-fill!
>>   (lambda (v x)
>>     (let ((n (vector-length v)))
>>       (do ((i 0 (+ i 1)))
>>           ((= i n))
>>           (vector-set! v i x)))))
>> 
>> Python
>> def vector_fill(v, x):
>>     for i in range(len(v)):
>>         v[i] = x
>> 
>> To me the Python code is easier to read, and I can't possibly fathom
>> how somebody could think the Scheme code is easier to read.  It truly
>> boggles my mind.
> 
> Pick a construct your pet language has specialized support, write an
> ugly equivalent in a language that does not specifically support it
> and you have proved your pet language to be superior to the other
> language. (I myself have never used the "do" macro in Scheme and my
> impression is few people do. I prefer "for-each", named "let" or the
> CL-like "dotimes" for looping).

Whiile true, if solving a problem requires you to use a lot of constructs
that one language provides and for which youave to do lots of extra work 
in teh other, one might aswell take the pragmatic approach that the other
language is better for the given problem at hand.

> 
> Cheers,
> --
> Grzegorz

-- 
	Sander

+++ Out of cheese error +++




More information about the Python-list mailing list