This is the archived Fall 2013 version of the course.
For the most recent version, see

Class 5: She Sells C Shells (by the Rust Shore)

PDF version of notes for printing

Action Items

You should have a teammate for PS2 by now. If you don't, hang around after class to find one.

PS2 is now posted and is due on Monday, September 30. Please be aware that it is significantly more challenging than PS1, and it is a very bad idea to delay getting started on it!

Course Philosophy

What is my goal for the lectures?

What are my academic goals for the course?

We wish to establish in the upper country of Virginia, and more centrally for the State, a University on a plan so broad and liberal and modern, as to be worth patronizing with the public support, and be a temptation to the youth of other States to come and drink of the cup of knowledge and fraternize with us. (Thomas Jefferson's letter to Joseph Priestly, 1800)

If this doesn't coincide with your personal goals, what should you do?

Thomas Jefferson enrolled in the College of William and Mary on March 25, 1760, at the age of 16... By the time he came to Williamsburg, the young scholar was proficient in the classics and able to read Greek and Latin authors in the original... He was instructed in natural philosophy (physics, metaphysics, and mathematics) and moral philosophy (rhetoric, logic, and ethics). A keen and diligent student, he displayed an avid curiosity in all fields and, according to family tradition, he frequently studied fifteen hours a day. (From Jefferson's College Life.)

What is my goal for the assignments? What should your goal be?

Some professors who want to minimize grading time have the misfortune of teaching as schools without strong honor systems like UVa. This forces them to adopt other solutions, like the "Tiger Professor" approach: Severe CS 161 syllabus provokes controversy among students (The Daily Californian, 3 September 2013)

Danny Lewin

Danny was killed on September 11. He was on American Flight 11 on his way to meetings in California when his plane was hijacked. In true Danny form, he fought back against the terrorists in an effort to defend the stewardesses and the cockpit. To this day, those of us who knew him well can’t figure out how only five terrorists managed to overpower him. During his short life, Danny made extraordinary contributions to the internet and to computer science through his work in algorithms and complexity theory. The impact of his work will be felt throughout the hi-tech industry for many years to come.

Tom Leighton's remarks naming of the STOC Best Student Paper Award in honor of the late Daniel Lewin


If you are interested in using and contributing to the Rust documentation Jordi is developing, they are at (Note that these are targeting the latest version, so may not be entirely consistent with version 0.7, but its also fine if you want to upgrade to using the latest version.) If you are also interested in contributing to improving them (instead of competing with my daughter's efforts), visit this github page and #rustdoc-wg on

I am far too modest to include a link to the Prospect Magazine Article I mentioned, but if you'd like to read another article about my experience at Udacity, I'd recommend One Year Later (a blog post I wrote) or David Carr's Information Week Article.

Shell Code

use std::{io, run};

fn main() {
    static CMD_PROMPT: &'static str = "gash > ";

    loop {
        let line = io::stdin().read_line();
        let mut argv: ~[~str] = line.split_iter(' ').filter(|&x| x != "")
                                    .transform(|x| x.to_owned()).collect();
        if argv.len() > 0 {
            let program = argv.remove(0);
            match program {
                ~"exit"     => { return; }
                _           => { run::process_status(program, argv);}