MT3 review outline ------------------ General bring to the exam: your textbook mc-eval.scm homework solutions Mutation DO NOT UNDERESTIMATE BOX-AND-POINTER DIAGRAMS, DRAW THEM FIRST! box-and-pointer diagrams ONLY CONS CREATES NEW PAIRS (... and things that use cons, e.g. list, quotation, ...) initial pointers a pointer to any part of a pair points to the WHOLE pair what are dummy elements like *table* for? using set! on local variables is useless why don't queues need one? what's wrong with this attempt at count-pairs? (define (count-pairs lst) (define (cp-helper lst pair-list) ;; WRONG (cond ((not (pair? lst)) 0) ((memq lst pair-list) 0) (else (set! pair-list (cons lst pair-list)) (+ (cp-helper (car lst) pair-list) (cp-helper (cdr lst) pair-list) 1) ))) (cp-helper lst '()) ) Spring 95 MT3 Q3. deep-map! Spring 96 MT3 Q2. list-rotate! Fall 96 MT3 Q2. merge! Concurrency remember that different serializers do not protect against each other can we solve concurrency with software? abstraction: serializers ------------- mutexes ------------- test-and-set! issues correctness efficiency fairness deadlock when does deadlock occur? Streams memoization (stream-filter even? (stream-filter odd? integers)) how to merge two infinite streams? interleaving good technique for figuring out what recursively interleaved streams look like: if you know one of the interleaved streams, write it out with blanks between known elements, then fill in every other blank Fall 98 MT3 Q6. mystery good technique for generating streams in which each element depends on previous element stream-accumulate partial-sums Fall 94 Final Q4. random stream Spring 95 MT3 Q4. oz Fall 96 MT3 Q3. foo Spring 98 MT3 Q1. (1) (1 2) (1 2 3) (1 2 3 4) (1 2 3 4 5) ... stream MCE special forms vs. primitives vs. compound procedures lexical vs. dynamic scope when making changes, what's relevant?