# Homework #2: Problem 3 # This worksheet tests the procedure reverse, which reverses the order of lists and characters of a # string. -------------------------------------------------------------------------------- # Input the definitions from procedure `reverse`. > read reverse; -------------------------------------------------------------------------------- # Test reverse with a list of numbers, words, and the null list. > reverse([1,2,3,4]); [4, 3, 2, 1] > reverse([one,two,three,four]); [four, three, two, one] > reverse([]); [] -------------------------------------------------------------------------------- # Test reverse with a string. > reverse(`This is a string`); gnirts a si sihT -------------------------------------------------------------------------------- # Test reverse with some invalid input. > reverse(2*s); Error, (in reverse) 2*s, is not a string or list > reverse({1,2,3,4}); Error, (in reverse) {3, 4, 1, 2}, is not a string or list > reverse(howdy-doo); Error, (in reverse) howdy-doo, is not a string or list