[plt-scheme] Re: "Zipping" two lists?

From: Jed Davis (jdev at panix.com)
Date: Thu Feb 23 14:21:27 EST 2006

Greg Woodhouse writes:
> Carl Eastlund wrote:
>
>> Does (map list my-list1 my-list2) do what you want?
>
> Uh...yeah (sheepish look).

But if you still want a zip function, I suggest:

(define (zip . ls) (apply map (cons list ls)))
; Makes for a nice demonstration of apply, too.

-- 
let p = List.map (fun c k _-> k (print_char c))
in List.fold_right (fun f a _ -> f a) (List.map2
(fun f g k -> f (g k) ()) (p ['J';'d';'D';'v';'s'])
(p ['e';' ';'a';'i';'\n'])) ignore ()



Posted on the users mailing list.