CSC151.02 2015S, Class 06: Writing Your Own Procedures
======================================================

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
    * Questions.
* Sequencing operations in Scheme.
* The drawings-as-values model, revisited.
* Why define your own procedures?
* How to define your own procedures.
* Evaluating expressions in Scheme.

Preliminaries
-------------

### Admin

* New partners!  These will also be your homework partners.
* Office Hours: Normally: 10:00-11:00 MTWF
* Please follow the suggestions for the title of your email messages;
  many of the graders have filters running to automatically move
  work to grade into a particular folder.
* I'm going to try to talk less today; we'll see how well I do.
* Quiz 2 is Friday
    * Evaluation in Scheme (define, order of evaluation, etc.)
    * Drawings as values
    * *Not* procedures 
* Don't forget: Review sessions Thursday at 9:00 a.m. and 1:15 p.m., 
  Mentor session Thursday at 8:00 p.m.
* I'm going to try talking less at the start of class today.  You'll need
  to take responsibility for reading the outline/eboard for announcements.
* We normally expect today's lab to take about 1.5 class periods.

### Upcoming Work

* [Assignment 3](../assignments/assignment.03.html).
    * Due next Tuesday at 10:30 p.m.
* Lab writeup for lab 6 (today), due Friday before class: 
  <http://bit.ly/151-2015S-lab06>
* No additional readings for Friday.

### Extra Credit Opportunities

#### Academic 

* Friday, 12:10 p.m., JRC 224A (Day PDR), CS Table, To be determined. 

#### Peer Support (Afternoon Section)

* Swimming, Friday, January 30, 6:30 p.m., Osgood Natatorium
* Swimming, Saturday, January 31, noon, Osgood Natatorium
* Men's Tennis, Saturday, January 31, Field House

### Recommended Events (no EC unless mentioned above)

* Gene Gaub Concert today!
* #OneGrinnell, Wednesday, February 4 at 4:15 p.m.

### Questions

Notes from Lab
--------------

### How Sam Writes Questions

"Write a procedure, `(centered-circle side left top)`", means

> The procedure name is `centered-circle`

> The parameters are `side`, `left`, and `top`

> I should write

        (define centered-circle
          (lambda (side left top)
            ...))

### Getting Started

Gimp, MediaScheme->DBus Server, Check for DrRacket 5.3.6 will
become automatic

### Vocabulary

You are learning a vocabulary.  You have some responsibility to remember
the words and the parameters.  You should find the best way to do that
for you.  I recommend the index cards for reference.

### Checking Your Answers

One experiment is not enough!

    ; inputs val, lower-bound, upper-bound
    > (bound 5 0 10)
    > (bound -5 0 10)
    > (bound 15 0 10)
    > (bound 5 10 0)

    ; inputs to centered-square: edge-length, center-x, center-y
    > (image-show (drawing->image (centered-square 40 50 60) 100 100))
    > (image-show (drawing->image (centered-square 20 40 30) 100 100))
    > (drawing-width (centered-square 1000 20 30))
    ...
    > (image-show (drawing->image (centered-square -20 40 30) 100 100))

### Computer Programming as Video Game

Level 1: When I click "Run", it doesn't complain.

Level 2: When I enter an expression, it doesn't complain.

Level 3: When I enter an expression, it produces something close to
the value that I expect.

Level 4: When I enter an expression, it produces something I know is
correct.

Level 5: When I enter a large variety of expressions, it always produces
the right thing.

### Formatting Your Code

Sarah says "Hit enter so that it's clean and pretty."

Samh says "After hitting enter, use Ctrl-I

### Save!

DrRacket will crash.

You will accidentally close the window.

Saving will make you happier, and should be automatic.
