[plt-scheme] Re: "Zipping" two lists?
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 ()