CS 1323 Section 30, Spring 1997
Individual Project 1
Due Wednesday, January 22, 3:30pm
Using Canned Software to Arrange Names in Alphabetical Order
- Step 1: Create a file called "names.hs"
with the following contents.
import SequenceUtilities(quicksort)
namesDisplay =
unlines[
"John Peterson",
"Kevin Hammond",
"Alastair Reid",
"Mark Jones",
"Paul Hudak",
"Brian Boutel",
"Andrew Gordon",
"John Hughes",
"Simon PeytonJones",
"Philip Wadler",
"Thomas Johansson",
"Lennart Augustsson",
"Warren Burton",
"Joseph Fasel"]
swapNames = unwords . reverse . words
swapAllNamesInSequence names = [swapNames name | name <- names]
alphabeticalDisplay =
(unlines . swapAllNamesInSequence . quicksort .
swapAllNamesInSequence . lines) namesDisplay
- Warning!
- You must follow the indentation carefully.
- And ... get all the periods and commas in the right places.
- Also ... don't mix up square brackets and round parentheses.
- Step 2: Use the following procedure to
download some canned software from the Web.
- Get into the CS 1323 Section 30 (Page) Class Pages
- Click on Supplied Software ...
then on SequenceUtilities.lhs ...
-
to a screen that starts with the line
"module SequenceUtilities"
- Pull down the File menu from the top of the Netscape window
and select "Save As ..."
- Now a dialogue box for saving the file will appear ...
- If you are using an ECN Unix workstation, click OK.
- If you are using an ECN Windows system ...
- Make a note of the name the system will use when it saves
the file. For names that contain capital letters or for
names longer than eight characters, the file will be saved
under a name different from the one you expect. (In this
case, the name will be sequence.lhs.)
- Pull down the Drives
menu and select the "h:" drive. Then click OK.
- Wait! You're not done yet. Now telnet to ecnalpha and login.
- Issue the command "flip -u sequence.lhs" in the ecnalpha session.
- Finally, again in the ecnalpha session,
make a copy of the file sequence.lhs:
"cp sequence.lhs SequenceUtilities.lhs"
- You can remove the file sequence.lhs if you like.
You no longer need it.
- If you are using your own computer at home, you're on your own.
Your goal is to get the file named SequenceUtilities.lhs from
the CS1323h Web site to the place where you plan to run Hugs.
- Congratulations. You now a have file named SequenceUtilities.lhs ...
- It contains some software you will use is in this project.
- Step 3: Get into a terminal window and run your program as follows.
- Enter the command
- script
to the Unix system.
This will record your session.
- Enter the command
- hugs
to the Unix system.
This starts the Hugs system.
- When the Hugs system settles down ...
Enter the command
- :load names.hs
to the Hugs system.
Now you're ready to run.
- Enter the command
- putStr namesDisplay
to the Hugs system and
observe its response.
- Enter the command
- putStr alphabeticalDisplay
to the Hugs system ...
Again observe.
- Enter the command
- :quit
to the Hugs system ...
Now you're out of Hugs and back in Unix.
- Hold the Control-key down and press the D-key.
This stops the recording of the script.
Your session is now recorded in the file "typescript".
- Follow the instuctions involving "removeBS,
in the Standards for Session Transcripts section of the
Haskell Project Style Guide
to prepare the file "typescript.cln".
- Print the file named "typescript.cln"
(see your Unix Survival Kit for printing instructions) ...
- You now have a printed copy of your session.
- Use the printed copy to prepare your project
report, following the Project Document Requirements in the
Haskell Project Style Guide.
- Have a glass of orange juice.
CS 1323 Section 30 - Fundamentals of Computer Programming -
Spring 1997
Instructor:
Rex Page
(Email: page@ou.edu)
Up to: Welcome Page ~~~
Up to: University of Oklahoma ~~~
Go to:
Next Semester ~~~
Go to:
Previous Semester