This assignment is intended to make you run a trivial program in several different programming languages, so you don't struggle with silly logistical surprises on later and more interesting assignments. It also touches structural concepts in a superficial way.
Make sure to follow the general instructions for performing and submitting homework.
Write a recursive or iterative procedure to reverse a list of arbitrarily many single characters in each of the following languages: C (or C++), ML, Scheme, and Prolog. Some of these languages have a reverse function built in---for exercise please write your own recursion or iteration. Reverse is given as an example in the manuals for some of these languages. It's OK to find the program in the manual. In each case, choose an appropriate data structure to represent lists of single characters. Your procedure and data structure may impose a limit on the length of the list, as long as that limit is trivial to change without affecting the structure of the procedure.
Demonstrate your procedures on an interesting set of inputs. In this, and all subsequent programming problems, part of the assignment is to figure out a set of test cases that really illuminates the behavior of your code. A small handful of cases (perhaps 3 or 5) should be sufficient. Strive for clarity rather than for volume or cuteness.
Notice that I asked you to write ``procedures,'' rather than ``programs.'' In most programming assignments, I am interested in the transformation of a data structure into another data structure, not in the input and output of text representing that data structure. Of course, in some of the programming languages you will need to embed your procedure in a program containing input and output commands in order to demonstrate its behavior. In that case, make sure that it is easy for a reader to separate the required procedure from the program that contains it. In some of the programming languages you may be able to use interactive interpreters to avoid describing input and output procedures.
Explain very briefly the important and fundamental structural reasons why the following Pascal program does not satisfy the requirements of the assignment. Do not waste time describing fine points of Pascal.
program reverse(input, output); var length: 0..10; list: array[1..10] of char; begin length := 0; while not eoln do begin length := length + 1; read(list[length]); end; writeln('Here is the reversed list:'); for i := length downto 1 do begin write(list[i]) end; writeln end.