CSC302 2006S, Class 42: Wrapup Admin: * Sorry about last night. Overview: * Grading. * About the final. * About the midsem. * Wrapup. * Evaluation forms. Final Topics: * Languages * Prolog: Probably small program ; Possibly hybrid * Haskell: Focus on laziness or patterns or HOP; Possibly hybrid * FP: Concepts * Ruby * SQL * Concepts * Denotational semantics * Polymorphism * Types * Future of languages * Closed book, closed computer * One page of notes, 8.5 x 11 inches (or A4), double-sided, hand-written Midsem * Consider v1 : f1 = short -> short v2 : f2 = short -> int v3 : f3 = int -> int * Claim: In a general form of equiv, we might allow vi = vj where fi and fj are functional types if the domain of fj is a subset of the domain of fi and the range of fj is a subset of the range of fi BAD IDEA TO PERMIT suppose short = 1..10 suppose int = 1..100 v3(50) OK v1(50) BOOM. OUTSIDE OF DOMAIN v3 = v1 THE CLAIM IS INCORRECT Problem 1: Assume E => I = E * First important consequence is that expressions can change the env meaningExp :: Exp Env -> N WHOOPS NEED TO RETURN A NEW ENVT, TOO ONE POSSIBILITY meaningExp :: Exp Env -> (N x Env) ANOTHER POSSIBILITY meaningExp :: Exp Env ECont -> ... NEED TO REWRITE EVERYTHING THAT USES meaningExp TO USE THE POTENTIALLY-CHANGED ENVT NEED TO REWRITE E1 + E2 Problem 2: (define cachedcont 0) (define suspend (lambda () (let/cc k (let ((resume cachedcont)) (set! cachedcont k) (resume)))))