This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Design of Programming Languages - Fall 2004 Final Exam December 21, 2004 Do any 8. 1. (10 pts) Type Judgments and ML code . You are given the ARRAY-GET type judgment: Γ ξ , Γ φ , Γ ρ ` e 1 : ARRAY( τ ) Γ ξ , Γ φ , Γ ρ ` e 2 : INT Γ ξ , Γ φ , Γ ρ ` ARRAY-GET( e 1 , e 2 ) : τ Within the functiom fun typeof (e, globals, functions, formals) of typed Impcore, you have the function ty , which takes only the expression e as an argument, using the remaining arguments of typeof as free variables and returns the type of its argument according to the type judgment above. (7 pts)Write the code completing ty(AGET(a, i)) where (AGET(a, i)) is the appropriate form of the expression e . (3 pts) In which type judgments will you specifically need to access or modify the three type environments, Γ ξ , Γ φ , and Γ ρ ? You don’t need to provide full details - just the names. 2. (10 pts) Higher Order Functions - either μ Scheme or ML . Filter is a function that normally takes a pair of parameters, a function, and a list, and returns the sublist of the original list consisting of all those elements which produce true when evaluated by the function parameter. The original list is unchanged. (5 pts) Define a Curried version of Filter . (5 pts) Using this version of Filter define a function - in the same language as the first part - that will take a list of integers and return the list of those that are multiples of 4....
View Full Document
- Fall '09
- pts, Evaluation strategy, denotational semantics, type judgment, Prolog program