Please use scheme programming with Dr Racket Create a recurs
Please use scheme programming with Dr. Racket
Create a recursive procedure called (pairs lst1 lst2) that returns a list of pairs from 2 given lists. Use comments to indicate in the code the four steps of the fantastic approach. You can assume that the both lists have the same length. [10 points]
Test case: (pairs ‘(1 2 3) ‘(a b c)) should give \'((1 . a) (2 . b) (3 . c)).
Solution
(define (pairs list1 list2) (if (or (null? list1) (null? list2));step 4 \'() ;stopping condition (cons(cons (car list1) (car list2)) (pairs (cdr list1) (cdr list2)));size n ))