Docsity

3 Problems on Type Systems and Type Inference | CS 360, Assignments of Programming Languages

Toggle sidebar
bg1
Homework 3
CS360 Spring 2005
DUE: May 16, 2005 6:00pm
Hand-in assignment at the start of class or put in my mailbox or under my door.
Objective: To gain a better understanding of type systems and type inference.
Reading Chapter 6
1) ML Types
Explain the ML type for each of the following declarations
(a) fun a(x,y) = x + 2 * y;
(b) fun b(x,y) = x + y / 2.0;
(c) fun c(f,x) = f(f(x));
(d) fun d(x,y,b) = if b(y) then x else y;
2) Problem 6.21 from Louden.
3) Use the following parse graph to calculate the ML type for the function
fun f(g,h) = g(h) + 2;

Partial preview of the text

Download 3 Problems on Type Systems and Type Inference | CS 360 and more Assignments Programming Languages in PDF only on Docsity!

Homework 3 CS360 Spring 2005

DUE: May 16, 2005 6:00pm Hand-in assignment at the start of class or put in my mailbox or under my door.

Objective: To gain a better understanding of type systems and type inference.

Reading Chapter 6

  1. ML Types Explain the ML type for each of the following declarations (a) fun a(x,y) = x + 2 * y; (b) fun b(x,y) = x + y / 2.0; (c) fun c(f,x) = f(f(x)); (d) fun d(x,y,b) = if b(y) then x else y;

  2. Problem 6.21 from Louden.

  3. Use the following parse graph to calculate the ML type for the function fun f(g,h) = g(h) + 2;