Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
10 Cards in this Set
- Front
- Back
Base Types |
Int, bool, and unit and compound types. |
|
Compound Types |
types that contain other types in their definition. |
|
"each of" compound type |
A compound type t describes values that contain each of values of type t1, t2, ..., and tn |
|
"One of" compund type |
A compound type t describes values that contain a value of one of the types t1, t2, ..., or tn. |
|
"self reference" compound type |
A compound type t may refer to itself in its definition in order to describe recursive data structures like lists and trees. |
|
Record types |
“each-of” types where each component is a named field |
|
record expression (syntax, type-checking, evaluation) |
Syntax:{foo : int, bar : int*bool, baz : bool*int}
Type-Checking:can have type {foo : int, bar : int*bool, baz : bool*int} because the order of fields never matters
Evaluation: the expression {bar = (1+2,true andalso true), foo = 3+4, baz = (false,9) } would evaluate to the record value {bar = (3,true), foo = 7, baz = (false,9)} |
|
By Names |
records we build them and access their pieces by using field names |
|
by position |
position (first, second, third, ...) to distinguish the components. |
|
Syntatic sugar |
we can describe everything about tuples in terms of equivalent record syntax. It issugar because it makes the language sweeter. |