Week 9 Set c
Due Date Fri at 9pm (Week 9)
Purpose To practice the design of functions on mutually recursive data definitions
Finger Exercises
Graded Exercises
Exercise 2 Design the function find-path. Its inputs are a Symbol and a symbolic S-expression:Otherwise it is #false.Specifically, the path that find-path produces is a list of indexes that takes you to the first (leftmost) occurrence of the given Symbol in the given Sexpr. Because this last part is somewhat ambiguous, let’s refine it. If the given Symbol and Sexpr are equal, the path is '(). Otherwise the path starts with a 0-based index that points to the leftmost Sexpr in the list that contains the Symbol. Thus the result for '(b c a d e f) and 'a is '(2).
Note This problem might be the most complicated problem this semester. If you follow the design recipe systematically, you are most certainly going to find a concise solution. If you do not follow it or only partially, it is unlikely that you find a solution.