COMP 302 Lecture Notes - Lecture 19: Pattern Matching, Type Inference, Type System

54 views6 pages

Document Summary

We learned about type variables and type inference. We learnt how to figure out the types of variable with unannotated code. To goal was to make the most general guess consistent with the constraints. The same flexibility in the type system that allows you to have polymorphism is the same thing that lets you do type inference. We did the map example, though it was kind of confusing, as he wrote it like this: map = fun f -> fun l -> As we are more used to seeing stuff like this: map f l = The latter one is just training wheels" for those not used to seeing functions. An expression (e), a type ((cid:555)), and a context to which we have assigned types to variables ( ). And an additional ingredient, c, which is a set of constraints expressed as equations.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents