Details for Monday Morning
Morning Lecture
A Computer Science should not be tolerated in high school; it should be
a core course like English or Algebra.
Why it isn't -- justifiedly
How we can make it one -- the goals of TeachScheme!
---------------------------------------------------------------------------------
PROGRAM is a mechanism that consumes some class of information and
produces a class of information in response, "big" examples
COMPUTATION is the process when a program consumes a particular piece of
information, works with it, and produces some information in response
INFORMATION: some knowledge about the "world"
Small example:
- conversion of temperature
- consumes degrees according to Celsius
- produces degrees according to Fahrenheit
- when we apply it to 0C, we get 32F: that's a computation
------------------------------------------------------------------------------------------
PROGRAMMING LANGUAGE: a language for describing programs and, ideally, computations
Algebra is such a language!
DATA: a representation of information in the chosen computer language
Questions:
COMPUTER: "Where is computer?" -- it doesn't matter!
INPUT/OUTPUT: How do we get data into the computer? -- it doesn't matter
--> picture
------------------------------------------------------------------------------------------
How do we calculate temperature conversion: algebra expression
-- Scheme expression
If we use it many times, we want to name the rule and learn to use it
-- Scheme definition, application
What does it all look like in DrScheme?
area of disk: expression; Scheme + calculation
area of ring (disk with hole): expression; Scheme + calculation
------------------------------------------------------------------------------------------
THE RECIPE
------------------------------------------------------------------------------------------
Here are the "rules" (programs) to convert
-- inches to cm (define (inches-to-cm i) (* 2.5 i))
-- feet to inches (define (feet-to-inches f) (* 12 i))
-- feet to cm (define (feet-to-cm1 f)
(* 30 i))
(define (feet-to-cm2 f)
(inches-to-cm
(feet-to-inches f)))
The last two are equivalent; the second one is far better: when I
introduce a better conversion, I only change one function.
They are equivalent by function composition, an algebraic concept w/o
motivation that has just become extremely useful. Point to table in book
with 12 conversion functions.
THE FIRST PRINCIPLE: re-use functions!
Morning Lab:
RECAP: area of square
PRAGMATICS: some syntax errors, some run-time errors
ASSIGNMENTS:
- 2.4:1; 2.5:1+2
- 2.10; 2.11
- 2.14
PLAY: ping-pong, use ping-pong-lib.ss (change-speed)