Question: Use Racket (preferred) or python Write a structurally recursive function (interleave lst1 lst2) that takes as arguments two lists, lst1 and lst2. interleave returns a
Use Racket (preferred) or python
Write a structurally recursive function (interleave lst1 lst2) that takes as arguments two lists, lst1 and lst2. interleave returns a list of pairs, where each pair consists of the items at the corresponding positions in lst1 and lst2. For example:
> (interleave '(a b c d e) '(1 2 3 4 5)) '((a . 1) (b . 2) (c . 3) (d . 4) (e . 5))
You may assume that lst1 and lst2 are the same length. Extra credit: Implement interleave so that it handles lists of unequal lengths gracefully.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
