PLQ #6Done on:   Tuesday, February 21st

Question 1 @ 2023-02-21 18:53

You’re running into a situation where a language that you need to implement is very different from the language you’re implementing it in.

What kind of evaluator would you likely implement for this language?


Question 2 @ 2023-02-21 18:59

We’ve seen how the core of the Y combinator leads to an inifinte nesting of calls to F:

((lambda (x) (x x))
(lambda (x) (F (x x))))
=>
(F (F (F ...)))

What would we get if we’d change it to:

((lambda (x) (G (x x)))
(lambda (x) (F (x x))))
=>
???

Question 3 @ 2023-02-21 19:02

Are the following two definitions of Y valid and equivalent?

(define Y1
  (lambda (f)
    ((lambda (x) (f (lambda (n) ((x x) n))))
    (lambda (x) (f (lambda (n) ((x x) n)))))))

(define Y2
  (lambda (f)
    ((lambda (x) (x x))
    (lambda (x) (f (lambda (n) ((x x) n)))))))

Question 4 @ 2023-02-21 19:05

Why do we need “protection” when writing our Y combinator?


Question 5 @ 2023-02-21 19:07

Which of these is NOT a combinator?