Details for Tuesday Morning
Morning Lecture
Syntax: page 79--80 (prepare hand-out)
Semantics:
- what are values: numbers, booleans, symbols
- primitives computing on basic values
- functions on values: beta-value
- the laws of conditionals
Examples: small and big
---------------------------------------------------------------------------------
THE DESIGN RECIPE FOR STRUCTS
Data analysis and data definition:
A position is (cons num (cons num empty))
If so, introduce constructors and selectors:
(define (make-pos x y) (cons x (cons y empty))
(define (pos-x a-pos) (first a-pos))
(define (pos-y a-pos) (first (rest a-pos)))
Compare distance-to-O with and without selectors
Apply to (cons 3 (cons 4 empty)) and (make-pos 3 4)
Morning Lab:
RECAP: evaluate in DrS
(/ (* 12 33) 9)
(/ 45 9)
5 ===> EXECUTE: must see same value printed everywhere; delta: BUG
SYMBOLS: eq?
ASSIGNMENTS:
- (sqrt (+ (* 4 4) (* 3 3)))
- (define (f x y) (sqrt (+ (* x x) (* y y)))) and (f 4 3)
---------------------------------------------------------------------------------
RECAP: STRUCTs (use personnel record), data-driven; wage
(define (wage hours a-pr)
(* hours (pr-hourly-rate a-pr)))
Introduce make-posn for screen (upside-down)
Play with draw-solid-disk, draw-solid-rect, etc.
Write down series of expressions in DEF; execute
Draw face
ASSIGNMENTS
- 4.3
- 5.12--5.14