Lab 1: up and running
be able to start up DrRacket,
be able to run trivial programs (numbers, strings),
have completed the intro survey,
be able to translate simple expressions into Racket, and
have combined graphical operators to make a simple picture.
In this lab, you’re going to be writing a whole bunch of simple code. One note: don’t delete earlier code when you go on to later parts; just leave the code there in the definitions window, so that I can see it all when it’s time to grade it.
Please use comments to indicate which problem you’re solving.
1 Getting Started
The first thing you need is to find a computer, and sit down in front of it, and make sure you know the names of the people on both sides of you.
In the following instructions, I’m going to try to explain absolutely everything. Feel free to skim a paragraph if you don’t need that explanation.
The lab machines in this class are running the "Linux" operating system. The "operating system" is essentially the "master" program that a computer runs; it’s a program that allows you to run other programs, and supervises the resources of the machine. "Windows" is Microsoft’s popular operating system. "OS X" runs on Macintoshes
Before you do anything else, you need to "log in" to the computer. These
machines—
In order to log in, you’ll need to know your id (colloquially known as your "login"), which will be the first letter of your first name, followed by the first seven letters of your last name. You’ll also need to know your password. In principle, everyone here already knows their login and password. In practice, that has never been the case. Fortunately, the folks that can help you with this are downstairs, in the offices along the back wall of the lab.
The software that we’ll be using to develop our software is called "DrRacket", and it runs on pretty much every major operating system, and should be stable and reliable. *However*, there’s one big caveat; the "rsound" extension that we’ll be using to create and play music is written by *me*. It’s totally not stable and reliable. You’ve been warned!
2 Intro Survey
Before doing anything else, you should complete the first-day survey. See the links on the course schedule page.
3 Starting DrRacket
We’ll be using Linux this quarter. After logging in, you’ll need to start DrRacket.
There are a bunch of different ways to do it. Here’s the one I recommend
From the menu at the top left corner of the screen, choose System Tools, and in a submenu, "Terminal". This gives you a rectangular window you can type commands in. Nearly every operating system (OS X, Windows, etc.) has a terminal window, though they generally hide it from you.
In that window, type "/opt/racket/bin/drracket". Then hit return. Or enter. Whatever it says on that key.
This should start DrRacket. You might want to maximize the resulting window.
After starting DrRacket for the first time, you’ll need to choose a Language. Choose the "Beginning Student" language from the Language|Choose Language... menu.
4 Beginning of Prologue
Work through the HtDP 2e Prologue. Make sure to have a DrRacket session open while you read, and try all of the examples; correcting the errors you encounter while typing them in will be helpful in later work.
5 Tiny Exercises
These exercises should make sure that what you’re reading is making sense. Show me the results when you’re done. Leave all of them in the definitions window, so that I can see them all.
Write the expression that adds three to the product of nine and twelve. Does it produce what you expect?
Write the expression that computes the cosine of 3π/2. Does it produce what you expect?
Did you bother to think about what it would produce, or did you just run the program?
Write the expression that computes the length of your name.
Write the expression that computes whether your middle name is longer than the middle name of the person nearest to you.
Write the expression that draws your face. Here’s what mine looks like: