Question: 11. deep-reverse (OPTIONAL BONUS) Define a function similar to the built-in reverse function, except that it acts recursively, reversing the order the members of any

 11. deep-reverse (OPTIONAL BONUS) Define a function similar to the built-in

11. deep-reverse (OPTIONAL BONUS) Define a function similar to the built-in reverse function, except that it acts recursively, reversing the order the members of any nested sublists. You may not use the built-in reverse function as a helper function. However, you may use your own my-reverse function as a helper function Input: A single list which may contain an arbitrary number of elements and sublists, each sublists may also contain an arbitrary number of elements and sublists, nested to an any depth Output: A new list which contains all elements in reverse order, as well as recursively reverse order all members of sublists Example: (deep-reverse (((4 3) 6) ((7 2 9)(5 1))) (((1 5) (9 2 7)) (6 (3 4))) > (deep-reverse'((1 2) 3) (3 (2 1)) (deep-reverse ((4 5))) ((5 4) > (deep-reverse '(3 6 9 12) (12 9 6 3)

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!