Com S 342 --- Principles of Programming Languages HOMEWORK 0: GETTING STARTED (File $Date: 1995/08/25 20:44:48 $) Due: problems 1-3, in your discussion section, August 25; 5-14 beginning of class, August. 30. In this homework, you will get around a bit on the Com S department machines, send us vital information about your login, and recall (or learn) the basics of Scheme. The section headings below give the readings related to the problems. COURSE POLICIES AND PROCEDURES (HANDOUT) section 3.6 1. (10 points) If you haven't done this already, obtain a Com S department user account. To do this, go to the ``Unix Account Activation Terminal'' in 116 Atanasoff Hall. Then follow the directions on that terminal to get your account. If you have problems with this, contact the System Support Group (ssg@cs.iastate.edu) at 294-0179 or go to their office in 108 Atanasoff Hall. If you cannot complete this by the due date, let us know you are having problems, and hand this problem in as soon as you get your account. a. Send email to your TA with the subject "HW0, my information" Put in the body of the message the following information: your family name, your given name, the last 6 digits of your University ID number (i.e. your social security number), your Com S login name, your local phone number (if you have one), and time of the discussion/lab section for which you are registered. The format should look like the following example Family Name Given Name Last 6 of ID login Phone Section Leavens, Gary 123456 leavens 294-1580 F 9 We will use this information for grading reports, class lists, and as a means to contact you. (We won't let anyone see your phone number except the course staff.) 2. (12 points) This problem is about the course directory structure and the course documents in the docs directory. You need to log in to a Com S department machine to do it. Write brief answers to the following questions on a piece of paper and hand them in. a. Change to the directory /home/cs342/public. What are the names of the directories in /home/cs342/public? b. One of the directories in /home/cs342/public is called docs. Change to that directory. What is in the file ``running-scheme.txt''? (Just give a general description in one sentence.) c. In what file in /home/cs342/public/docs are the office hours for the course? What are the office hours of your TA? d. What is in the file ``getting-to-coms.txt''? e. What is in the file ``printing.txt''? f. What is in the file ``policies-complete.txt''? g. Are you eligible for makeups on homeworks and tests if you don't attend lectures and your discussion sections? The rest of this homework is found in the file /home/cs342/public/homework/hw0.txt You should work on-line from this file. You might want to print a copy if you'd rather have it in front of you. 3. (5 points) Read the file ``/home/cs342/public/docs/reading-news.txt''. Create the files that are suggested and try reading the news for our class (in the newsgroup isu.coms.342). There should be a message whose subject is: ``The message for HW0''. As your answer to this problem, write down the contents of that message. You should try to read the newsgroup isu.coms.342 fairly often. 4. (suggested practice) To make life easier on the Com S Unix machines, you may want to personalize your environment by doing the following. a. To avoid retyping the name of the course public directory, /home/cs342/public, it is nice to have a quick abbreviation for it. Put the following line in your ~/.login file, so that when you type $PUB in the shell it expands to /home/cs342/public setenv PUB "/home/cs342/public" To see this working, you'll have to log out and then log back in. Then try the command, to demonstrate that it's working. ls $PUB b. To access the programs in the course directory /home/cs342/public/bin easily, you can put the following line in your .login file setenv PATH ${PATH}:/home/cs342/public/bin Then log out and log back in for this to take effect. c. To save yourself retyping information about the class for assignments, make a file ~/.me containing ;;; Name: ;;; Section: where you fill in the information following the colons as appropriate. (Your section should be the letter and time.) d. The file ~/.cshrc can be used to customize the Unix (c)shell. Create this file and put in it the following line. alias rm 'rm -i' Make sure the file ends in a newline. This says to make the rm command (for removing files) always ask for confirmation; it may save your neck sometime. This makes pwd give you shorter strings. If you are a DOS user, you can put other lines in the file to alias your favorite DOS commands to their Unix equivalents. For example, you might want to use the following. alias dir ls alias copy cp alias rename mv e. The news readers on Unix, and some other programs use a file named ~/.signature. Create a file .signature in your home directory. It should contain your street address, your e-mail address, and (if you wish) your phone number. It should be no more than 4 lines long. f. For more information about details of using the Com S department machines, such as how to forward your mail to/from project Vincent, how to get your files to/from Vincent (use ftp), how to customize your X windows or how to display X windows stuff from a Vincent workstation, use the program ``mosaic'' on a Com S department workstation (or use the URL ``http://www.cs.iastate.edu/'') and click on the topic ``How Do I Do That'' in the first list of things, and then when you're in that page, click on the topic ``CS user FAQ'' (which is under the subheading ``Questions and Answers''). (The exact URL is ``http://www.cs.iastate.edu/help/fap.html''.) ESSENTIALS OF PROGRAMMING LANGUAGES: CHAPTER 1 and RUNNING SCHEME handout See the file /home/cs342/public/docs/running-scheme.txt for details about running scheme. 5. (suggested practice) Do exercise 1.2.1 in the text. Use the computer to check your work, but don't do this on the computer at first. 6. (6 points) Do exercise 1.2.2 in the text. Use the computer to check your work, but don't do this on the computer at first. What you hand in should be handwritten for this problem. 7. (suggested practice) Do exercise 1.2.3 in the text. 8. (5 points) Do exercise 1.3.1 in the text. Use the computer to check your work, but don't do this on the computer at first. What you hand in should be handwritten for this problem. 9. (3 points) Do exercise 1.3.2 in the text. Use the computer to check your work, but don't do this on the computer at first. What you hand in should be handwritten for this problem. When checking your work, you needn't type the code in yourself, as you can find the code for this (and all other exercises and figures) in the file /home/cs342/public/eopl/sources.ss Have your editor search for ``;;; Exercise 1.3.2 : page 26''. 10. (5 points, extra credit) Do exercise 1.3.3 in the text. 11. (5 points) Do exercise 1.3.4 in the text. For this, hand in a printout of a file containing your procedure curry2, labeled with your course information (as in problem 4c above), and a transcript of your testing. 12. (suggested practice) Do exercise 1.3.5 in the text. 13. (15 points, extra credit) Do exercise 1.3.6 in the text. 14. (5 points) Do exercise 1.3.7 in the text. For this, hand in a printout of a file containing your procedure compose, labeled with your course information (as in problem 4c above), and a transcript of your testing.