> .... > In scheme, I believe you just have recursion. > .... Cousin TJR ....
I'm a total scheme rookie starting only about 3 days ago and one of the mechanisms I went looking for was a technique for iteration .... Found in the scheme docs about iteration supplied via the reduce package .... "Iterate and reduce are extensions of named-let for writing loops that walk down one or more sequences such as the elements of a list or vector, the characters read from a port, or arithmetic series .... " The following scheme session illustrates a trivial example .... > , open reduce > > ( define ( list_loop this_list ) ( iterate loop ( ( list* this_item this_list ) ) ; iterate expression ( ( new_list '( ) ) ) ; state expression ( loop ( cons ( * 2 this_item ) new_list ) ) ; body expression ( reverse new_list ) ) ) ; final expression ; no values returned > > ( define L '( 1 2 3 4 5 ) ) ; no values returned > ( define result_i ( list_loop L ) ) ; no values returned > > result_i '(2 4 6 8 10) > However, just as in Python the map function might be both easier to code and more readable in many cases .... > ( define ( x2 n ) ( * 2 n ) ) ; no values returned > > ( define result_m ( map x2 L ) ) ; no values returned > > result_m '(2 4 6 8 10) Note .... No lambdas in my scheme code either .... ;-) -- Stanley C. Kitching Human Being Phoenix, Arizona ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- -- http://mail.python.org/mailman/listinfo/python-list