HMWK4
Due: 12 April 2017, by end of class
1) a) Identify languages which are object-free; have traditional scalars and objects; have only objecrs.
b) Are all sub-classes also sub-types? Why?
c) What language features are lost if space allocation is purely static?
d) fun junk (string x, int y) {.....};
z = junk{y=7; x="fred"};
e) Explain one disadvantage of inheritance.
2) Consider the (pseudo-code) function: defn fact x = if x < 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.