Functional Problem Solving (CSC 151 2015S) : EBoards

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


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support (Afternoon Section)

Recommended Events (no EC unless mentioned above)

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.