PLQ #3Done on:   Tuesday, October 13th

Question 1 @ 2020-10-13 18:25

Last time we said that there’s a serious problem with our language implementation. What was it?

  1. It lacks a representation for compound values like tuples and lists.
  2. It depends on Racket-specific features.
  3. It is too lazy.
  4. It is too eager.
  5. It is too slow.
  6. It uses too much space.
  7. It uses substitutions.

Question 2 @ 2020-10-13 18:28

OK, so the problem is that it’s too slow. Can you be more specific?

  1. The cost of a function call is O(n²) for functions with a body of size n.
  2. The cost of a function call is O(n²) for functions with a body of depth n.
  3. The cost of a function call is O(n) for functions with a body of size n.
  4. The cost of a function call is O(n) for functions with a body of depth n.
  5. The cost of a function call is O(2ⁿ) for functions with a body of size n.
  6. The cost of a function call is O(2ⁿ) for functions with a body of depth n.
  7. The cost of compiling a function O(n²) for functions with a body of size n.
  8. The cost of compiling a function is O(n²) for functions with a body of depth n.
  9. The cost of compiling a function is O(n) for functions with a body of size n.
  10. The cost of compiling a function is O(n) for functions with a body of depth n.
  11. The cost of compiling a function is O(2ⁿ) for functions with a body of size n.
  12. The cost of compiling a function is O(2ⁿ) for functions with a body of depth n.

Question 3 @ 2020-10-13 20:11

If we have this:

{with {x 3}
  {with {f {fun {y} {+ x y}}}
    {with {x 5}
      {call f 4}}}}

in the substitution-based evaluator (FLANG, the one with subst), what would we get?

  1. runtime error
  2. type error
  3. 6
  4. 7
  5. 8
  6. 9
  7. 10

Question 4 @ 2020-10-13 20:18

If we have this:

{with {x 3}
  {with {f {fun {y} {+ x y}}}
    {with {x 5}
      {call f 4}}}}

in the NEW AND FIXED subst-cache evaluator (the LAST one we just went over, the one with the closures), what would we get?

  1. runtime error
  2. type error
  3. 6
  4. 7
  5. 8
  6. 9
  7. 10

Question 5 @ 2020-10-13 20:22

If we have this:

{with {x 3}
  {with {f {fun {y} {+ x y}}}
    {with {x 5}
      {call f 4}}}}

in the BROKEN subst-cache evaluator (the one BEFORE we added closures), what would we get?

  1. runtime error
  2. type error
  3. 6
  4. 7
  5. 8
  6. 9
  7. 10