Details for Tuesday Afternoon



Afternoon Lecture

  Teacher presentation

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

  Varieties of Data: 
    We have many different kinds of data; Scheme provides predicates to
    recognize them. 

    Example 1: Points on axis, points in plane
    (define (distance a-pt) 
      (cond
        ((number? a-pt) a-pt)
	((cons? a-pt) ...)))

    Example 2: A shape is either a circle or a rectangle
      area-of-shape: shape -> num
    How to distinguish them: conditional expression for distpatch but they
    are both cons'ed. Introduce rect? and circle? ... 
    Now switch to square and circle. Same data! We need tags. 

  The design recipe for mixed programs

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

  Overview of Ping-Pong: 
  Creative: the idea of simulating ping pong
  Plan: top-down -- need "vocab" to talk about moving balls
  Programming: bottom-up; simple first, complex situations later


Afternoon Lab:

RECAP: 
  when we design a function, ask - which design recipe
  when we design an expression, ask - re-use of function

ASSIGNMENT: 
  start implementing Ping-Pong: voluntary teams (section 5.4)
  [probably won't finish]

PLAY: Protect-the-Wall, if time permits



EVALUATION