• 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/5

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;

5 Cards in this Set

  • Front
  • Back

Immutable

Cannot be modified after it is created.

Function Binding

Syntax:


fun x0 (x1 : t1, ... , xn : tn) = e



Type-checking:


- adds binding x0 : (t1 * ... * tn) -> t if:


- can type-check body e to have t in the static environment containing:


• "enclosing" static environment (earlier bindings)


• x1 : t1, ... , xn : tn (arguments with their types)


• x0 : (t1 * ... * tn) -> t (for recursion)



Evaluation:


A function is a value.


- adds x0 to environment so later expressions can call it


- function-call semantics will also allow recursion

Recursive

Repeating itself using a more simplified version until a base argument is reached

Type interface

Automatic deduction of the data type of an expression

Function Calls

Syntax:


e0 (e1, ..., en) with the parentheses optional if there is exactly one argument



Type-checking:


e0 has a type that looks like t1 * ... * tn -> t and for 1 ≤ i ≤ n,ei has type ti. Then the whole call has type t



Evaluation:


use the environment at the point of the call to evaluate e0 to v0, e1 to v1, ..., en to vn. Then v0 must be a function (it will be assuming the call type-checked) and we evaluate the function’s body in an environment extended such that the function arguments map to v1, ..., vn