Lecture 2, June 21
The lecture notes I post serve two purposes: to remind you of the topics we discussed and to provide any interesting code examples I did during lecture. I would describe these notes as an outline, not a summary, of what I talked about during lecture. You are not expected to be able to learn the material simply from examining these notes, nor is reading these notes a reasonable substitute for attending lecture.
Command Line
Commands
- ls - list contents of working directory
- cd - change working directory
- pwd - print working directory
- mkdir - make a new directory
- touch - update time-stamp on an existing file or create a new file
- rm - remove a file (or a directory with -r)
- cp - copy a file (or directory with -r)
- mv - move a file or directory
- man - open manual for a given command
- apropos - search manuals for a given term
Relative vs. Absolute Paths
You can specify a path two different ways. One is relative to the current working directory (the name you specify MUST be in the current working directory). The other is with an absolute path (you must specify the entire path from the root of the file system to the file or directory).Subversion
Commands
- svn co URL - Create a working copy of a repository
- svn commit -m "MESSAGE" - Push any changes from the working copy to the server
- svn add PATH - Stage a new file for addition during the next commit
- svn rm - Stage an existing file for deletion during the next commit
- svn update - Update an old working copy to match the most recent copy on the server
- svn status - Get a list of differences between the working copy and the server
- svn log - List log messages
- svn help - Open documentation
Images
(require typed/2htdp/image)
Functions to create simple images: square, circle, rectangle, ellipse, line.
Functions to compose multiple images: beside, above, overlay, overlay/offset.
Other image functions: image-width, image-height.
Don't memorize any more than the above functions. Expect to rely heavily on the documentation for finding the functions you need for solving homework assignments.
big-bang example
This is a modification of the big-bang example in the text for typed racket.
#lang typed/racket (require typed/2htdp/image) (require typed/2htdp/universe) (: number->square : (-> Nonnegative-Real Image)) (define (number->square s) (square s "solid" "red")) (: decr : (-> Nonnegative-Integer Nonnegative-Integer)) (define (decr n) (if (> n 0) (sub1 n) 0)) (big-bang 100 : Nonnegative-Integer [to-draw number->square] [on-tick decr] [stop-when zero?])