Structure and Interpretation 2 Flashcards
What have we done so far?
We have used primitive arithmetic operations, we have combined these operations, and we have abstracted these composite operations by defining them as compound procedures.
How can we define a procedure in terms of evolution?
A procedure is a pattern for the “local evolution” of a process. It specifies how each stage of a process is built upon the previous stage. We would like to be able to make statements about the overall, or “global” behavior of a process whose local evolution has been specified by a procedure.
Where does the word “local” come from?
From the Latin “Locus” meaning place.
In general, the number of steps required by a tree-recursive process will be proportional to ____.
The number of nodes in the tree.
In general, the space required by a tree-recursive process will be proportional to _____.
the maximum depth of the tree
A programming language uses an evaluation strategy to determine ____.
when to evaluate the argument or arguments of a function call and what kind of value to pass to the function.
Delaying evaluation of procedure arguments until the last possible moment (e.g. until they are required by a________) is called lazy evaluation.
primitive operation
What is a higher order procedure?
A procedure that produces a procedure as its value.
In an applicative order language _____ when the procedure is applied.
all the arguments are evaluated
In a normal order language, ____ until the argument values are needed.
evaluations of procedure arguments are delayed
What two things does the call mechanism involve?
The parameter passing mechanism
The replacement of the call to the function by the body of the function called (without the header)
Applicative order evaluates subexpressions _____.
when, i.e. just before, the procedure is applied.
Normal order evaluates subexpressions as they are, without evaluation, and proceeds with the evaluation only when ____.
the corresponding formal parameter is actually itself to be evaluated.
evaluate all arguments, then apply operator
applicative order evaluation
pass unevaluated expressions to function, evaluate only when needed for primitive operation
normal order evaluation