PLQ #10Done on:   Tuesday, November 19th

Question 1 @ 2024-11-19 18:03

Assuming that our test tool can catch these errors, which of the following tests would show that our language is actually lazy?

(Note: multiple choice)


Question 2 @ 2024-11-19 18:05

In the previous question, there was an assumption:

Assuming that our test tool can catch these errors, […]

Is that assumption needed? Why?

(Remember: Choose the best answer.)


Question 3 @ 2024-11-19 18:07

In the same question still, we know that we could replace {/ 9 0} with the omega combinator: {{fun {x} {x x}} {fun {x} {x x}}}.

But we also know that to make a distinction between a lazy and an eager language, we need to somehow involve side-effects.

How do settle these two things?


Question 4 @ 2024-11-19 18:10

What is the purpose of calling strict on (eval* fun-expr) in the following Sloth implementation bit:

[(Call fun-expr arg-exprs)
(define fval (strict (eval* fun-expr)))
(define arg-vals (map eval* arg-exprs))
(cases fval
    ...)]

Question 5 @ 2024-11-19 18:12

In Sloth (the first lazy language we’ve implemented, without caching), how many times does the expression {+ 1 2} get evaluated when we run the following code?

{bind {{x {+ 1 2}}}
  {bind {{y {+ x x}}}
    {bind {{z {+ y y}}}
      {+ z z}}}}

0…16

Question 6 @ 2024-11-19 18:14

In Slug (the second lazy language we’ve implemented, which adds caching), how many times does the expression {+ 1 2} get evaluated when we run the following code?

{bind {{x {+ 1 2}}}
  {bind {{y {+ x x}}}
    {bind {{z {+ y y}}}
      {+ z z}}}}

0…16

Question 7 @ 2024-11-19 18:15

In the lazy Racket language that we’ve used, #lang pl lazy, we can observe the following interaction:

> (let ([r (random 100)])
    (list r r r))
'(53 53 53)

This shows us that #lang pl lazy is …?