PLQ #6Done on:   Tuesday, October 22nd

Question 1 @ 2024-10-22 18:31

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 2 @ 2024-10-22 18:35

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


Question 3 @ 2024-10-22 18:36

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 @ 2024-10-22 18:39

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?