PLQ #8Done on:   Tuesday, March 16th

Question 1 @ 2021-03-16 18:31

Say that we’re using a(n infix) language that implements = assignments. It can be said that the expression

x = y = x

swaps the values of x and y. Given this (and that all of the expressions in our language evaluate to some value) what must an assignment expression evaluate to in our language?


Question 2 @ 2021-03-16 18:34

Say that we’re using a(n infix) language that implements = assignments. It can be said that the expression

x = y = x

swaps the values of x and y. Given this (and that all of the expressions in our language evaluate to some value) we know that assignment expressions evaluate to the old value.

What did we assume to make that conclusion?


Question 3 @ 2021-03-16 18:37

Which of the following subtype relations hold?

(T1 ⊂ T2 means T1 is a subtype of T2; Select all that apply.)


Question 4 @ 2021-03-16 18:42

What will be the result of the following test for the with in HW10?

(->nat (with [* +]
        (with [x (* 3 3)]
          (with [+ *]
            (+ x x)))))

Question 5 @ 2021-03-16 18:46

Is the TOY language eager or lazy?


Question 6 @ 2021-03-16 18:48

(test (run "{bind {{identity {fun {x} x}}
                  {add1 {fun {x} {+ x 1}}}}
              {{identity add1} 123}}")
      => 124)

Does the above test pass in TOY?