HMWK5
Due: 8 May 2023, by end of class
1) Explain two advantages and one disadvantage of supporting inheritance in a programming language.
2) Consider the (pseudo-code) function {n.b. ".lt." is just less than}: defn fact x = if x .lt. 2 then 1 else x * fact (x-1);
Show the sequence of stack allocations in the execution of fact(5).
3) Write a ruby function which takes 2 lists (which represent sets) and retun the list representing the union of those two sets {HEY! please don't use the ruby union or uniq functions, they make the question boring [and will reduce points earned]. Show that you understand how to manipulate lists.}
4) a) Describe the basic difference between call-by-reference
and call-by-value parameter passing.
b) Write a short piece of pseudo-code which would have different
results under the different schemes.
5) Given the definitions {n.b. "\" is meant to stand for lambda}:
2 = \f . \x. f (f x)
plus = \m. \n. \f. \x. m f (n f x)
compute the value of (plus 2 2)