0

I am trying to write a function called zip that accepts two lists as parameters and and returns a single list whose elements are taken alternatively from the original lists

ex. (zip '(a b c) '(x y z)) should evaluate to (a x b y c z)

asdfghjkl
  • 393
  • 3
  • 8
  • 20

1 Answers1

4

Skeleton solution:

(define (zip l1 l2)
  (cond ((null? l1) l2)
        ((null? l2) l1)
        (else (cons ??? (cons ??? (zip ??? ???))))))

Fill in the ??? yourself. :-)

C. K. Young
  • 219,335
  • 46
  • 382
  • 435