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)
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)
Skeleton solution:
(define (zip l1 l2)
(cond ((null? l1) l2)
((null? l2) l1)
(else (cons ??? (cons ??? (zip ??? ???))))))
Fill in the ???
yourself. :-)