Programming Languages Flashcards
What is a value?
A value is an expression that cannot be simplified any further.
What is the term for:
an expression that cannot be simplified any further.
Value
What term describes:
the types of all preceding bindings in the file.
static environment
what term describes
the value of all preceding bindings in the file.
dynamic environment
Give a rough definition of the static environment.
The static environment is roughly the types of all preceding bindings in the file.
Give a rough definition of the dynamic environment.
The dynamic environment is roughly the value of all preceding bindings in the file.
What is the term for “how an expression or statement is written”?
syntax
stack data structure containing a element for each function that hasn’t finished executing.
call stack
What is the term for “how an expression or statement is interpreted (i.e. how it is evaluated and type checked)”?
semantics
describes a function call when there are no more pending computation after it is evaluated.
Tail call
Describes the position of an expression e
, when there are no pending computations after e
is evaluated.
tail position
What are the questions we ask when we encounter a new language construct?
- What is the syntax?
- What are the type checking rules?
- what are the evaluation rules?
What is a “call stack”?
stack data structure containing a “stack frames” for each function that hasn’t finished executing.
used to refer to a sub-type of an algebraic type.
variant
In the context of algebraic-types, what does the term “carries” mean?
describe when a variant wraps one or more value.
within the context of compound types, this is a piece of information that distinguishes one variant of a “one-of” type from the others.
tag
a function with free variables that have been closed (or bound) by an environment.
closure
A variable used within a function body that is neither a local variable or a function parameter.
free variable
What is a “stack frame”?
A data structure containing information about a function invocation.
What is a “tail call”?
A function call that occurs in “tail position”.
What is “tail position”?
Describes the position of an expression e
, when there are no pending computations after e
is evaluated.
How many kinds of compound types are there?
There are 3 types.
List the types of compound types.
- sum-types or “each-of” type
- algebraic-types or “one-of” type
- self-referential type
what is a variant in the context of “compound types”?
A variant refers to a sub-type of an algebraic type.
What is the term used to describe when a variant wraps one or more value.
the variant “carries” one or more values.
in the context of the “client/implementer” idom, this is a construct that hides the implementation of a solution, while providing the client with information on how to use the solution.
abstraction boundary
In the context of compound types, what is a “tag”?
within the context of compound types, this is a piece of information that distinguishes one variant of a “one-of” type from the others.
What is a closure?
a function with free variables that have been closed (or bound) by an environment.
- A function/expression must be closed before it can be evaluated.
- pairing an open function with an environment that binds the functions free variables, provides the information needed to evaluated the function (i.e. closes the function)
- with lexical scoping, functions are closed by the current lexical environment.
What is a “free variable”?
A variable used within a function body that is neither a local variable or a function parameter.
What is “parametric polymorphism”?
describes the property of a function/datatype when it can accept one or more type parameters.
describes the property of a function/data type when it accepts one or more type parameters.
parametric polymorphism
In the context of parametric polymorphism, what does the term “instantiated” mean?
In the context of parametric polymorphism, this is when a type parameter is reduced into a more concrete type (e.g. the type parameter ‘a becomes int)
What is the “client-implementer” idiom?
Describes a method to separate the knowledge of traversing a complex data structure/problem space, from that of operating on the different components of of the data structure.
What is a “closed function”?
A function that does not reference any free variables.
Define “scope” as it relates to name bindings.
The environment in which a binding is valid.
What is “lexical scope”?
A scope which is determined by the lexical position of the binding. In other words, the environment in which the binding is valid is the current environment at the point in the file where the binding was defined.