PLQ #7Done on:   Tuesday, November 2nd

Question 1 @ 2021-11-02 20:17

Which of the following are correct definitions of list-ref in Schlac with our church-encoded values?


Question 2 @ 2021-11-02 20:20

Consider the following expression in plain Racket (#lang pl without the types, or just #lang racket):

(let ([a 1]
      [b (lambda () (+ a c))]
      [c 2])
  (b))

How does Racket’s evaluation of this expression behave with each of the different let variants:

  1. (let ([a 1] [b (lambda () (+ a c))] [c 2]) (b))
  2. (let* ([a 1] [b (lambda () (+ a c))] [c 2]) (b))
  3. (letrec ([a 1] [b (lambda () (+ a c))] [c 2]) (b))

The answers are listed in respective order for (1), (2), (3):


Question 3 @ 2021-11-02 20:23

Consider the the following Schlac expressions. There is exactly one expression that is different according to its semantics than all of the others. Which one is it?


Question 4 @ 2021-11-02 20:25

One annoyance in auto-curried languages like Schlac is the lack of variable-arity functions. Can this be improved somehow?

For example, can we implement a Racket-like list function?