Why aren't we all speaking LISP now?

Greg Ewing see at my.signature
Tue May 15 06:23:01 CEST 2001


Courageous wrote:
> 
> (dolist), which is identical in
> function to Python's for: form, and (map) which is identical in function
> to Python's map/lambda

It's the same in Scheme -- (foreach ...) if you don't want
a result and (map ...) if you do. There's no need to use
recursion just for traversing a list! (Not explicitly,
anyway - the implementation might well use recursion
under the covers.)

For doing more complicated things, there's also a general
iteration construct (called (do ...) if I remember correctly)
but the syntax is so frigging hard to remember that it's 
often easier and clearer to write it recursively even if 
you don't strictly need to.

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list