I am trying to write a function called unzip that takes a list and evaluates to a list of two lists that have alternating elements of the original list.
so far this is what i have:
(define (unzip lst)
(if (null? lst)
'()
(...
this is how it should work:
(unzip ‘(1 a 2 b 3 c)) should evaluate to ((1 2 3) (a b c))
What you have is on the wrong track, sorry. (Think about what the result should be if given an empty input.) Similar to my answer to your last question, here’s a skeleton solution:
Fill in the
???s appropriately. (Yes, my solution is tested and works for both odd and even inputs.)