Quiz 4 Flashcards
(λ x . + 3 x) 4
What is the value of the lambda expression above?
7, 4, 3, or 1?
7
ML allows function overloading, T/F?
False
ML is statically typed, so that the type of every expression is determined before execution, and types can be checked for consistency, T/F?
True
Which of the following is not a feature of Haskell?
Lazy Evaluation, Dynamic Typing, Pattern Matching, or Immutability?
Dynamic Typing
val h :: t = [4,2,1,3];
For the given assignment in ML above, what is the value of t?
[2,1,3], 4, 3, or [4,2,1,3]?
[2,1,3]
Which of the following programming languages has lazy evaluation by default?
ML, Haskell, Scheme, or Lisp?
Haskell
__________ is a rule in lambda calculus that allows you to change the name of the bound variable in a lambda expression without changing the expression’s meaning. It’s essentially renaming the formal parameters to avoid name clashes or improve clarity.
Beta-abstraction, Eta-conversion, Alpha-conversion, or Beta-reduction?
Alpha-conversion
__________ is the process of applying a function to its argument in lambda calculus. E.g., ((λx. + x 1) 2) => (+ 2 1)
Eta-conversion, Alpha-conversion, Beta-abstraction, or Beta-reduction?
Beta-reduction
Scheme does not allow delayed evaluation, T/F?
False
fun pow (x,0) = 1 | pow (x,y) = x * pow (x, y-1);
For the given power function in ML above, which of the following is the correct syntax to calculate 35?
pow(3,5), (pow) 3 5, (pow 3 5), or (3,5) pow
pow(3,5)