Details for Monday Afternoon



Afternoon Lecture

  Ping-Pong requires:
   -- dealing with conditional situations; 
   -- dealing with compound data; 
   -- dealing with graphics (lab)

---------------------------------------------------------------------------------

  Claims are true or false: 
    given any x on numberline, only one of 
    -- x = 0
    -- x < 0
    -- x > 0 
    holds; examples!
  Teachers guess at Scheme syntax: (= x 0) (< x 0) (> x 0)

  Consider interval on number line: all numbers between 0 and 5. To
  describe it, we need compound claims: (and (< 0 x) (< x 5))

  How to evaluate such expressions: Booleans!
 
  Did the ball land inside of some interval? Testing claims, describing intervals
  inside-0-5: num -> bool

---------------------------------------------------------------------------------

  Sometimes the method for computing results differs depending on what the
  input is. We need CONDITIONAL EXPRESSIONS: shape (question-answer); use;
  evaluation. 

  Example: interest-rate: num[amount] -> num[rate]

  THE DESIGN RECIPE FOR CONDITIONALS
  
---------------------------------------------------------------------------------
  
  Lists and Structures: empty + cons
  Apply functions to lists: need to be able to "get things back": first + rest
  CONStructors and selectors

  Example: Points in space and distance-to-O
  Information: a point is described by a list of two numbers
  Data: a point is represented as (cons num (cons num empty))

  Example: Dates and distance to 0 (assume: 360 days per year; 30 days per month)
  Information: year/month/time in AD,
  Data: a triple of three positive numbers: (cons num (cons num (cons num empty)))
  

Afternoon Lab:

RECAP: 
  Recipe for conditions: draw intervals, assign expressions, pick tests
  Use 3.14 as example

ASSIGNMENTS:
  - 3.15                            --> HELP: ONE MORE IF TIME PERMITS <--

RECAP: 
  what are lists: compound two values: some value (number) and a list
  cons, first, rest

ASSIGNMENTS: 
 
  - date-minus
  - 5.7: 1+2; 5.8



EVALUATION