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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!