Scheme Exercises
back to exercise list
previous next
Group: Exercise: 34/48
Deep Reverse:
reverse the order of elements even deep inside sublists
Create the function (deep-reverse L) which will be given a list which can contain sublists (within which there may be even deeper sublists). All elements of all lists need to be reversed. For instance: (deep-reverse '(a b c)) ; -> (c b a) (deep-reverse '(a (b c))) ; -> ((c b) a) (deep-reverse '((a b) c d (e (f g)))) ; -> (((g f) e) d c (b a))
|