This lab is mostly designed to give you a chance to get used to using C++ and lisp in our now lab. Additional instructions for various software, such as eXodus, cvs, and emacs, are available on the Haverford unix software web page, http://www.haverford.edu/cmsc/course-pages/usingSW.html .
Log in on one of the Stokes 8 lab computers, either by going to the lab, or by using eXodus from one of the other Haverford or Bryn Mawr labs. (You can also use an x-terminal or X software on a PC if you have access to either of those and know how to use them.) Start a command-line terminal window if one doesn't already exist (go to the menu bar at the bottom of the screen and click on the picture of a CRT with text).
Use the command "cvs checkout simple-funcs" to get a copy of the simple functions project, which includes the factorial functions we discussed in class. You may need to use the mouse to position the pointer in your command-line terminal window, or click on this window, to be able to type in it.
Use the unix "cd" command to change into the simple-funcs directory (type "cd simple-funcs").
Then test both factorial functions in both languages - you can test the C++ programs by typing "make factorial-test" and then running the program by typing "./factorial-test". Typing "make test" does this for you, using the numbers 5, 6, 10, 12, and 21 as test numbers. You can test the lisp version by typing "gcl factorial-test.lisp", which also automatically does the test with the same numbers.
Create programs in lisp and C++ to compute x to the nth power, for nonnegative integer n and positive real number x. Write two functions in each language, using the recursive "functional" style, and the iterative "procedural" style. If you like, you can try to use the O(log(n)) algorithm (in the recursive function only, unless you're looking for a challenge). These programs should follow the organization of the factorial programs, with one file to define the function, and a separate file to do the testing. You can copy the files ("cp oldname newname" makes a a copy of the file "oldname", and names the copy "newname") and then edit them (using emacs or some other editor that you're familiar with) if you're not sure where to start.
Your lisp files should be power.lisp and power-test.lisp; your C++ files should be power.h, power.c and power-test.c. Update the makefile so that "make power-test" compiles your test program.
Use "cvs add" to add the 5 new files, and cvs commit to submit your finished project.
There's a lot to learn for those of you who haven't used UNIX before. In this case, make sure to take advantage of all lab sessions and my office hours, and send me email if you need more help.