• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/10

Click to flip

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 type

Programming languages have base types, like int, bool, and unit

compound types

Compound types are types that contain other types in their definition. We have already seen ways to make compound types in ML, namely by using tuple types, list types, and option types.

"each of "compound type

A compound type t describes values that contain each of values of type t1, t2, ..., and tn.

"one of "compound 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

Record types are “each-of” types where each component is a named field.

record expression(syntax,type-checking,evalution)

A record expression builds a record value.


In general the syntax for a record expression is {f1 = e1, ..., fn = en} where, as always, each ei can be any expression.


The type-checking rules for record expressions are not surprising: Type-check each expression to get some type ti and then build the record type that has all the right fields with the right types.


The evaluation rules for record expressions are analogous: Evaluate each expression to a value and create the corresponding record value.

"by name"access

By name is a classic decision when designing a language construct or choosing which one to use, with each being more convenient in certain situations.

"by position"access

By position is simpler for a small number of components, but for larger compound types it becomes too difficult to remember which position is which.

syntactic sugar

We say, “tuples are just syntactic sugar for records with fields named 1, 2, ..., n.” It is syntactic because we can describe everything about tuples in terms of equivalent record syntax. It issugar because it makes the language sweeter. The term syntactic sugar is widely used. Syntactic sugar is a great way to keep the key ideas in a programming-language small (making it easier to implement) while giving programmers convenient ways to write things.