Exam2F05 - Design of Programming Languages - Fall 2005...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Design of Programming Languages - Fall 2005 Second Exam : Nov. 15, 2005 Do any 5. 1. (10 pts) ML, Types and Fixed Points. (4 pts) Derive the type of fun F g x = g (F g) x and show your derivation steps. (6 pts) Given the function val g = fn f => fn x => if x = 0 then 1 else x*f(x - 1) derive its type (2 pts) and trace through the computation F g 3 (4 pts). 2. (10 pts) Type Judgments and ML code . Consider the two judgments for Array Formation and Array Make. τ is a type ARRAY( τ ) is a type Γ ξ , Γ φ , Γ ρ e 1 : INT Γ ξ , Γ φ , Γ ρ e 2 : τ Γ ξ , Γ φ , Γ ρ ARRAY-MAKE( e 1 , e 2 ) : ARRAY( τ ) Within the function fun typeof (e, globals, functions, formals) of typed Im- pcore, 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. Write the code completing ty(AMAKE(len, init)) where AMAKE(len, init) is the appropriate form of the ex-
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2012 for the course CS 91.531 taught by Professor Giam during the Fall '09 term at UMass Lowell.

Page1 / 2

Exam2F05 - Design of Programming Languages - Fall 2005...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online