Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions