CSC302 2011S, Class 41: Debriefing on Presentations Overview: * Cyrus Mistry is EPIC. * Debriefing. * Continuations, Revisited. * CPS, Revisited. Admin: * Missing/Late: AC, DR * Planning Senior Lunch * My schedule is triply-hectic this week: * Normal end of semester stuff * An insane number of extra meetings * A family crises. I will be in my office as much as possible, but it will vary. Call or email to check if I'm here. * I plan to distribute the questions (but not the choices) for the final on Friday. I plan to get you presentation grades tomorrow night. I plan to get you as many grades as possible next Monday. * Don't forget CS picnic on Friday! * EC for the final CS extra of the year [academic]. * EC for today's psych presentation [academic/misc]. Debrief on Presentations * What went well? * It appears that CS majors can use Powerpoint. Wow! * And they like monospace * Well designed lab * Comprehensible Examples (e.g., Garbage Collection Group) * What could have been improved? (E.g., if you have to present again, in class or professionally?) * Dealing with two potential problems: Presenters who don't understand (or misunderstand) their topic; Presenters who are not comfortable presenting * We chose a presentation requirement that did not force everyone in the group to present * Sam could force groups to present to him in advance * Free Riders - Normal pitfall of any group work * Some people like graphics on PowerPoint rather than board * Check Markers * Volume issues * Was it a good use of time? * For presenters? * Yes, because forced (encouraged) us to learn things better * For audience? * Good change of pace * But it would have been nice to cover more stuff * The 7L7W approach * Need to slow it down and break up with lectures/discussion * Good job hunting skill * Comparative Programming Languages is a good skill * Modern programming uses multiple paradigms; learn a hybrid Continuations * A continuation represents "what happens to this result" * Need to know state of variables * The stack and the PC tell you a lot about the rest of the program * Continuations make this "what happens next" a first-class value * Issues * How * Why * What * Scheme continuations (call-with-current-continuation fun) * Wraps up the current continuation as an object * Calls fun on that value * aka (call/cc fun) * Invoking a continuation: Apply it like a unary function * An example > (square (+ (* 2 x) (/ 2 x))) 0 1 2 3 4 5 Implicit continuation at position 1 * (lambda (foo) (display (square foo)) (repl)) Implicit continuation at position 3 After we compute x, we have to multiply by 2 do the thing at the right (/ 2 x) add the two values square, display, repl (lambda (_) (let (r1 (* 2 _)) (r2 (/ 2 x))) (display (square (+ r1 r2))) (repl)) When you invoke a continuation, you replace the current continuation (rest of the program) with the new continuation > (define cont null) > (square (+ 2 (call/cc (lambda (c) (set! cont c) x)))) ; cont is (lambda (_) (display (+ 2 _) (repl))) (+ 3 5) (+ 3 (cont 5))