Week 14 - FPL Flashcards
(82 cards)
What is the design of imperative languages based on?
Von Neumann architecture.
Why is it challenging to manage the state changes in large imperative programs?
Managing the state changes in large imperative programs is a daunting task due to the importance of variables and how the program’s state changes.
What does a function definition specify?
A function definition specifies the domain and range sets along with the mapping described by an expression or table.
How are functions applied?
Functions are applied to elements of the domain set to yield elements of the range set.
What controls the evaluation order of mathematical functions?
The evaluation order is controlled by recursion and conditional expressions rather than sequencing and iterative repetition.
How are function definitions written?
Function definitions are written with the name, list of parameters in parentheses, and a mapping expression.
What is a higher-order function or functional form?
A higher-order function or functional form takes functions as parameters and yields a function as its result or does both.
Describe functional composition.
Functional composition is a functional form that takes two functions as parameters and yields a function whose value is the first actual parameter function applied to the application of the second, e.g., h(x) ≡ f(g(x)).
What is the apply-to-all functional form?
The apply-to-all functional form takes a single function as a parameter and yields a list of values obtained by applying the given function to each element of a list of parameters.
What is the objective of designing functional programming languages (FPLs)?
The objective of designing FPLs is to mimic mathematical functions.
How is the basic process of computation in FPLs different from imperative languages?
In FPLs, variables and assignments are not necessary, freeing the programmer from concerns of memory cells. Computation is performed through recursion rather than iterative constructs.
What is referential transparency in FPLs?
Referential transparency means the evaluation of a function always produces the same result given the same parameters, making the semantics of FPLs simpler than imperative languages.
What are primitive functions in FPLs?
Primitive functions are a set of basic functions provided in FPLs, with a smaller number being considered beneficial.
Why are output functions usually not needed?
Because the interpreter always displays the result of a function evaluated at the top level.
What is a predicate function?
A predicate function returns a Boolean value.
What does (= x 11) return if x is 11?
T.
What does (> x 11) return if x is 11?
().
What does (< x 15) return if x is 11?
T.
What does (EVEN? x) return if x is 11?
().
What does (ODD? x) return if x is 11?
T.
What is the COND function used for in Scheme?
Multiple selection.
What does the QUOTE function do in Scheme?
It takes one parameter and returns it without evaluation.
Why is the QUOTE function used in Scheme?
To avoid parameter evaluation when it is not appropriate.
How can QUOTE be abbreviated in Scheme?
With the apostrophe prefix operator.