Question: Write a function that begins (define (superreverse L) superreverse will be a variant of reverse. Its input L will be a list that will only
Write a function that begins
(define (superreverse L)
superreverse will be a variant of reverse. Its input L will be a list that will only contain lists as elements. superreverse should output a list identical to L, except that all of its top-level lists should be reversed. No deeper structures should be altered. You may (and should!) use the built-in reverse function in your implementation of superreverse. For example,
(reverse '(1 2 3)) produces the list '(3 2 1).
Here are two examples. In the first, youll notice the notation #\a: this is Racket's way of representing single-character literals. (Nifty!). You can use this single-character datatype to emphasize when a variable differs from both symbols ('symbol) and strings ("string").
(check-equal? (super reverse '( (1 2 3) (4 5 6) (#\k #\o #\o #\l) (#\a #\m) )) '( (3 2 1) (6 5 4) (#\l #\o #\o #\k) (#\m #\a) ) ) (check-equal? (superreverse '( (1 2 3) (4 5 6 (7 8) 9 ) )) '( (3 2 1) (9 (7 8) 6 5 4) ) )
please use racket coding language to code this and also in
#lang racket
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
