PLQ #8Done on:   Tuesday, March 12th

Question 1 @ 2024-03-12 18:25

If S is a subtype of T, is (Boxof S) a subtype of (Boxof T)?


Question 2 @ 2024-03-12 18:28

Consider the following typed definition:

(: blah : (Rec T (List String (U Number T))))
(define blah (list "blah" 1))

What is the type of (second blah)?


Question 3 @ 2024-03-12 18:31

You’re given a language that fulfils the following test:

(test (map (+ 2) '(1 2 3)) => '(3 4 5))

Which of the following is a true statement about this language?


Question 4 @ 2024-03-12 18:34

When we discussed extending TOY with a set! expression for mutations, we made it return a bogus value.

What is the advantage of doing this?


Question 5 @ 2024-03-12 18:37

Continuing with the mutation-extended Toy language, what would the following evaluate to, if we make set! return the newly assigned value instead?

{bind {x 4}
  {bind {y {set! x 3}}
    {+ {set! x {+ x y}}
      x}}}