Sections 3.3 - 3.6 Flashcards
A program is a set of ___ and a ___.
set of definitions and an expression to be evaluated
The translation scheme TE can be regarded as a function from ____ to ____.
Miranda expressions to lambda expressions
The translation scheme TD translates ____ to ____.
Miranda definitions to letrec definitions
The translation rule for infix operators translates the operator to accommodate a ____.
change of names
True or false: The TD and TE translation schemes are inductive.
True. Both translation schemes are defined in terms of how they operate on the simplest expressions (the base case) and on compound expressions (the inductive case).
True or false: The TD scheme depends on TE.
True. To translate a Miranda definition one must also translate the body of the definition, which is a Miranda expression.
Translate the following Miranda definitions to letrec
definitions:
f x y = g (x + 3) y
g z = z * z
letrec
g = \z -> z * z
f = \x y -> g (x + 3) y