Quiz 3 - Scheme Lists, Again

CS 152 - Spring 2008

Name:

Student ID:

E-mail:

Scheme Lists

Write a Scheme function to return a list that contains the reverse of the elements of its argument. You may assume the argument is a (proper) list. You may design your solution with additional helper functions if you like.

(define (rev arg)
  ...)

Your program should behave as follows.

> (rev '(1 2 3))
(3 2 1)
> (rev '())
()
> (rev '((0 1) (2 3) (4 5)))
((4 5) (2 3) (0 1))

[Note]Note

Since textbooks have not shown in the bookstore, today's quiz is taken from prior material.