A. INDEX is a function that is already defined on Euclid and Venus. If N is any positive integer and L is any list, then (INDEX N L) returns the Nth element of L if N does not exceed the length of L; if N exceeds the length of the list L, then (INDEX N L) returns the symbol ERROR. For example, (INDEX 3 '(A S (A S) (A) D)) => (A S) (INDEX 6 '(A S (A S) (A) D)) => ERROR. Complete the following definition of a function MY-INDEX without making further calls of INDEX and without calling MY-INDEX recursively, in such a way that if N is any integer greater than 1 and L is any nonempty list then (MY-INDEX N L) is equal to (INDEX N L).
(defun my-index (N L)
(let ((X (index (- N 1) (cdr L)))) __ )) [Note: You should not have to call any functions.]
1) Define a recursive function INDEX with the properties stated in problem A. Note that the first argument of INDEX may be 1, and that the second argument may be NIL.