PLQ #7Done on:   Tuesday, March 9th

Question 1 @ 2021-03-09 19:09

What is the output of this function in our BRANG language?

{with {x 2}
  {bind* {{x 6} {y x}}
    {bind {{x y} {y x}}
      {- x y}}}}

Question 2 @ 2021-03-09 19:14

What must be true in order for

E == (lambda (x) (E x))

Question 3 @ 2021-03-09 19:19

Below is the truth table of XOR:

X    Y    Result
T    T      F
F    T      T
T    F      T
F    F      F

Which one of the following is a correct implementation?

Question 4 @ 2021-03-09 19:24

Given the following implementations of car, cdr, and cons in Schlac:

(define #t (lambda (x y) x))
(define #f (lambda (x y) y))
(define car (lambda (p) (p #t)))
(define cdr (lambda (p) (p #f)))
(define cons (lambda (x y) (lambda (s) (s x y))))

What happens when we run this test?

(define 3rd (lambda (l) (car (cdr (cdr l)))))
(define lon (cons 2 (cons 1 0)))
(test (->nat (3rd lon)) => 0)