program. Scheme 三层结果的案例与 agrees? 定义[mce-self-cases]

(define examples
   '((factorial
      ((define (factorial n) (if (= n 0) 1 (* n (factorial (- n 1))))) (factorial 6))
      720)
     (lexical
      ((define x 10) (define add-x (lambda (y) (+ x y)))
       ((lambda (x) (add-x 2)) 100))
      12)
     (closure
      ((define (make-adder x) (lambda (y) (+ x y)))
       (define add-three (make-adder 3)) (add-three 4))
      7)
     (lazy-if ((if #t 7 missing)) 7)
     (truth ((if 0 1 2)) 1)
     (mapping ((map (lambda (x) (* x x)) '(1 2 3 4))) (1 4 9 16))
     (application ((apply + '(1 2 3))) 6)
     (named-let ((let loop ((n 5) (total 0))
                  (if (= n 0) total (loop (- n 1) (+ total n))))) 15)
     (let-star ((let* ((x 3) (y (+ x 4))) (* x y))) 21)
     (short-circuit ((list (and #f missing) (or 9 missing))) (#f 9))
     (conditional ((cond ((= 1 2) missing) ((= 2 2) 8) (else 0))) 8)))

(define (run-host program)
   (eval (cons 'begin program) (make-fresh-user-module)))

(define (agrees? example)
   (let ((program (cadr example)) (expected (caddr example)))
     (and (equal? (run-host program) expected)
          (equal? (run-scheme program) expected)
          (equal? (run-inside program) expected))))