PLQ #11Done on:   Tuesday, April 1st

Question 1 @ 2025-04-01 18:40

At some point we’ve seen that we can end up with the wrong scope when we try to implement a lazy language.

How did we address this issue?


Question 2 @ 2025-04-01 18:42

Consider the following type definition for VAL from our lazy Sloth language implementation:

(define-type VAL
  [RktV  Any]
  [FunV  (Listof Symbol) SLOTH ENV]
  [ExprV SLOTH ENV (Boxof (U #f VAL))]
  [PrimV ((Listof VAL) -> VAL)])

Is this from the version of Sloth that implements a call by name or a call by need language?

(Choose the best answer.)


Question 3 @ 2025-04-01 18:44

Our first Sloth implementation was a “call by name” language, but then we switched to a “call by need” implementation.

Why?


Question 4 @ 2025-04-01 18:46

We’ve talked about how a whole class of programming problems become much easier to handle with laziness. What is it?


Question 5 @ 2025-04-01 18:47

Remember the type we used in class to represent IO operations in a lazy language:

(define-type IO
  [Print    String]
  [ReadLine (String -> IO)]
  [Begin2  IO IO])

Say that we want to add functionality to retrieve the contents of a URL. How should its representation (in the form of another IO variant) look like?