[plt-scheme] for-each - analagous to map

From: wooks (wookiz at hotmail.com)
Date: Mon Feb 16 01:15:15 EST 2009

Travelling salesman. So I have a tour that is list of numbers each
representing cities (0 11 3 7)

I need to get each  journey 0 - 11, 11 - 3, 3 - 7 etc

I do this

(map (lambda (cities shifted-copy) ....) cities (append (cdr cities)
(list (car cities)))

getting (0 11 3 7) and (11 3 7 0)  as my inputs to map.

So now  the car of each list (recursively) constitutes my trip

Ok that was just motivation.  I want to do this for side effects.

Does for-each share maps  ability to traverse multiple lists in this
way.



Posted on the users mailing list.