PLQ #2Done on:   Tuesday, October 4th

Question 1 @ 2022-10-04 19:15

Which of following is sensible and is formatted properly WRT indentation?


Question 2 @ 2022-10-04 19:22

What would be the result of this expression using our (hack of a) lazy evaluation implementation?

{with {y x}
  {with {x {/ 1 0}}
    {+ 2 y}}}

Question 3 @ 2022-10-04 19:29

In WAE, we had this bit in our subst function:

[(With bound-id named-expr bound-body)
(With bound-id
      (subst named-expr from to)
      (if (eq? bound-id from)      ; <============
        bound-body                  ; <=========
        (subst bound-body from to)))]  ; <======

If we replace the marked line with (subst bound-body from to) in subst below, what would we get?

{with {x 5}
  {+ x {with {x 3}
        {with {y x} y}}}}

Question 4 @ 2022-10-04 19:37

Choose all options that explains the problem with the following definition of substitution in WAE?

Substitution definition: To substitute an identifier i in an expression e with an expression v, replace all instances of i that are not themselves binding instances, and that are not in any nested scope, with the expression v.

(Choose all of the correct answers)