[plt-scheme] Why no zip in "list.ss"?

From: Woodhouse, Gregory J. (Gregory.Woodhouse at va.gov)
Date: Wed Dec 27 17:53:00 EST 2006

Good grief! I don't know how you keep coming up with things that leave me thinking "Why didn't I think of that?"

Anyway, I noticed that the SRFI was in help desk, but didn't know how or if they were available for use. 

Sent using BlackBerry

----- Original Message -----
From: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
To: Woodhouse, Gregory J.
Cc: plt-scheme at list.cs.brown.edu <plt-scheme at list.cs.brown.edu>
Sent: Wed Dec 27 12:59:35 2006
Subject: Re: [plt-scheme] Why no zip in "list.ss"?

> I could have sworn that zip was included in list.ss, but apparently not. 
> Certainly, it seems a natural.

Hi Gregory,

Here's an alternative implementation that you might like:

> (define (zip l1 l2)
     (map list l1 l2))
> (zip '(1 2 3 4 5) '(one two three four five))
((1 one) (2 two) (3 three) (4 four) (5 five))

But the ZIP function you're thinking of does exist in the SRFI-1 "list" 
library.  We can also say:

> (require (only (lib "1.ss" "srfi") zip))
> (zip '(1 2 3 4 5)
        '(one two three four five))
((1 one) (2 two) (3 three) (4 four) (5 five))



for more details.  Good luck!

Posted on the users mailing list.