PLQ #9Done on:   Tuesday, March 23rd

Question 1 @ 2021-03-23 18:22

Consider this segment of code which was part of our work on turning eval into a compile:

(: compile : TOY -> ENV -> VAL)
;; compiles TOY expressions to Racket functions.
(define (compile expr)
  (cases expr
    ...
    [(If cond-expr then-expr else-expr)
    (lambda ([env : ENV])
      (: compile* : TOY -> VAL)
      (define (compile* expr) ((compile expr) env))
      (compile* (if (cases (compile* cond-expr)
                      [(RktV v) v]
                      [else #t])
                  then-expr
                  else-expr)))]
    ...))

Which of the following is FALSE?


Question 2 @ 2021-03-23 18:27

What is the result of the following:

#lang pl lazy
(define a (cons a null))
(length a)