;;;; Assignment 0, Introduction to UNIX ;;;; ;;;; File: asst0.txt ;;;; Author: CS 51 (Bob Walton) ;;;; Version: 1 This assignment is merely a list of what you must do before you can start doing assignment 1. There is nothing to submit in assignment 0, nor is there any grade. Nevertheless, you should try to get it done by third day of class so you can start assignment 1 on time. If you have trouble with some of the below, you may ask questions using e-mail. Skip to near the bottom of this list for the e-mail introduction. (1) Be sure you get the book ``ANSI Common Lisp'' by Paul Graham, and start to read it in order to understand COMMONLISP. (2) Get your Harvard computer account and learn how to log in. See login.help. If you have registered but do NOT have a Harvard account by 1PM on the day after you have registered, then with very high probability there is some defect in your registration. Go PROMPTLY to the summer school registrar at 51 Brattle street, and check your registration with them, fixing any flaw they have found. Example flaws are failure to pay small fees or failure to fill out a required form. If the registrar is truly satisfied with your registra- tion, they will send information overnight to FAS computer services which will cause your account be created by 1PM the following day. Getting an account promptly is necessary because this course starts quickly. (3) After you log in, you can get into a LISP system and play around with LISP. Just type ~lib51/bin/lisp at the UNIX prompt. To get out of the LISP system type control-D The best way to learn a language like LISP is to try out language commands and features as you read the book or lecture notes. (4) Learn the commands in unix.help. The best way to do this is to play around with them after logging in. Try each command out, one at a time. Unless you are already familiar with UNIX, you should promptly get the book: Harley Hahn's Student's Guide to UNIX McGTraw Hill, 1996 ISBN: 0070254923 or some similar book and read it as necessary. There are also UNIX tutorial handouts in front of the computer User Services Desk in the Science Center. (5) Much of the course documentation is on-line. Try the following UNIX commands: UNIX Command Action cd ~lib51 Go to the CS 51 course home directory. cd help Go to the help subdirectory. ll List the contents of the current directory. vi vi.help Start the vi editor to look at the file named vi.help. (6) You are now looking at the help file for the vi editor. Try some of the commands mentioned in the vi.help file. If you try to write the file, you will not be permitted to because it is protected. To exit the editor type :q! and a carriage return. If you know another UNIX editor, you can use it in this course. The other editors available are PICO and EMACS. Vi is the best editor for this course, but is not necessarily the best for an individual person (people and editors are different). (7) Next make your own copy of assignment 1 as follows: UNIX Command Action cd Go to your home directory. mkdir cs51 Make a CS 51 directory. cd cs51 Go to your CS 51 directory. mkdir asst1 Make a directory for assignment 1. cd asst1 Go into that directory. cp ~lib51/asst1/* . Copy all the files in the ~lib51/asst1 directory into your asst1 directory. Ignore the message about omit- ting the RCS directory. ll List the files in the current directory (asst1). view functions.lsp Look at this file, which holds LISP code. view functions.in Look at this file, which holds input that you might type into a LISP system in order to test the code in functions.lsp. (8) Read the make.help file. Read the Makefile that is part of the assignment 1 handout (given out in the second or third class), or execute: view Makefile Look at the make commands for assignment 1. Try to understand some of the Makefile file. It is unnecessary for you to understand the Makefile very much at this point in the course, but getting some idea what it is doing should be helpful, if you do not spend much time at it. Next, execute: make functions.out This runs the file functions.in through a LISP system and produces output which is stored in the file functions.out. Because this is the first time you have made any output file, a number of other things will get made, like directories (e.g. ../bin) and pointer files (e.g. ../bin/lisp) which point at other files (e.g. ~lib51/bin/lisp). Compare what you see on the screen at this point to the printed copy you were given of the assignment 1 Makefile. Again you will probably only understand part of what you see, but try to get the gist of what ``make functions.out'' is doing. Next execute: view functions.out Look at functions.out. The functions.out file is made by starting up a LISP system and presenting the functions.in file to it as input. The functions.in file contains the LISP statement: (load "functions.lsp") which loads the file functions.lsp into the LISP system, so the variables and functions it defines can be used in the remainder of the functions.in file. Because you have not yet done assignment 1, the functions.out file will be missing various things. Nevertheless it is best to start each assignment by making the assignment's .out file and looking at it. (9) Another UNIX command you can execute is: make print This will print out the files involved in assignment 1. To print out just one file, e.g. functions.lsp, use ~lib51/bin/print functions.lsp The print commands we have just mentioned do NOT use the laser printer, which costs money. You should NOT use the laser printer except for final submission printout, which is done with `make sprint' instead of `make print'. (10) It is necessary to keep backup copies of the files you are working on, in case you accidentally delete them. Read the first page of the rcs.help file. To backup assignment 1 files, execute the UNIX command: make ci (where `ci' stands for `checkin' which is another word for backup.) For each file you will be asked to type a message followed by a line containing just a period. You may skip the message and just type a period followed by a carriage return for each of these questions. Until you backup the files you CANNOT write them, and therefore you cannot edit them or start the assignment. (11) The full list of make commands is: make functions.out Make the file functions.out make Make all assignment output files. For assignment 1 this is just functions.out. make print Print files you change plus output files. make ci Checkin (backup) files you change. make submit Submit the assignment for grading. Don't do this till you have finished the assignment. make sprint Print the files to be graded for the grader. Don't to this until after you do make submit. make clean Delete output files and any binary files made doing this assignment. Cleans up disk space usage; everything deleted can be remade. After you finish an assignment you should do `make submit' followed by `make sprint' and then turn in the printout at the next class. (12) Type the UNIX command: mail Start the mailer. Then send yourself a message by typing the mail command: m and filling in the message, ending with control-D. Quit the mailer by typing: q Then restart the mailer with the UNIX command mail and read the message by typing its number, which should be 1 Read the mail.help file and try out mailer commands. If you have not already sent any questions to the course instructors, think of some question and sent it by the mailer command: m lib51 Fill in the message and type control-D. (13) Now read lisp.help. Go into your asst1 directory, and start the LISP system by typing: ../bin/lisp (You can use the name ../bin/lisp only if you are in one of your assignment directories after you have done `make functions.out' for assignment 1. You can use the name ~lib51/bin/lisp from anywhere.) Now try typing: (run :in "functions" :pause t) The functions.in file will be run through the LISP system, one statement at a time. After each statement the computer will pause, and you must type carriage return to continue. After you are done you can repeat this process by typing: (run) because the RUN function remembers its last set of arguments so you need not retype them. (14) To work on your assignment you need to edit the file `functions.lsp'. You can do this from inside the LISP interpreter with the command: (vil "functions.lsp") When you :q to quit the editor (or :q!), the file will be loaded into the lisp interpreter, and you can test it by typing lines like: (fibonacci 4) to run functions defined in the file. If you do NOT want the file to load into the interpreter after you edit it, use `vi' in place of `vil'. If you want the file to be run instead of being loaded (e.g. if the file is "functions.in") then you can use `vir' instead of `vil'. If you want to use PICO instead of VI, use `picol', `pico', and `picor' instead of `vil', `vi', and `vir'. (15) Lastly, do: cd vi .login to edit your .login file and add the line source ~lib51/cs51.login right after the line source /usr/local/etc/sys.login Similarly, do: cd vi .cshrc to edit your .cshrc file and add the line source ~lib51/cs51.cshrc right after the line source /usr/local/etc/sys.cshrc Now log out and log back in again (to make these changes take effect). These lines you have added to your .login and .cshrc files set certain UNIX parameters in a way that should help you as a CS 51 student. For example, one of the benefits is that you should be able to type lisp instead of ~lib51/bin/lisp