Scheme Exercises

back to exercise list       previous     next

Group:     Exercise: 22/48 

rev3:  Reverse the elements of a 3-element list

Create the function rev3 which will be given a single argument (which must be a 3-element list), and will create a new list with the elements in reverse order.
For instance:
(rev3 '(a b c)) -> (c b a)
(rev3 '((+ 1 3) Fred George)) -> (George Fred (+ 1 3))
The function's "signature" describes to Racket how the function will be called. As the examples show, rev3 will be called with a single argument, so its signature must have a single identifier, to be used as a parameter. For example
(define rev3 (lambda (reverseMe) (...
(define (rev3 reverseMe) (...