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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon Feb 16 07:31:27 EST 2009

> (for-each (lambda (x y) (printf "got ~s ~s\n" x y)) '(1 2 3) '(a b c))
got 1 a
got 2 b
got 3 c


On Mon, Feb 16, 2009 at 3:46 AM, Jos Koot <jos.koot at telefonica.net> wrote:
> yes
> jos
>
> ----- Original Message ----- From: "wooks" <wookiz at hotmail.com>
> To: <plt-scheme at list.cs.brown.edu>
> Sent: Monday, February 16, 2009 7:15 AM
> Subject: [plt-scheme] for-each - analagous to map
>
>
>> 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.
>>
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.