You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
371 B
19 lines
371 B
|
|
Exercise 2.27: Modify your reverse
|
|
procedure of Exercise 2.18 to produce a deep-reverse procedure
|
|
that takes a list as argument and returns as its value the list with its
|
|
elements reversed and with all sublists deep-reversed as well. For example,
|
|
|
|
|
|
(define x
|
|
(list (list 1 2) (list 3 4)))
|
|
|
|
x
|
|
((1 2) (3 4))
|
|
|
|
(reverse x)
|
|
((3 4) (1 2))
|
|
|
|
(deep-reverse x)
|
|
((4 3) (2 1))
|
|
|
|
|