Chapter 4, Metalinguistic Abstraction

Exercise 4.54


1
2
3
4
5
6
7
8
9
(define (analyze-require exp)
  (let ((pproc (analyze (require-predicate exp))))
    (lambda (env succeed fail)
      (pproc env
             (lambda (pred-value fail2)
               (if (not (true? pred-value))
                   (fail2)
                   (succeed 'ok fail2)))
             fail))))

I tested it by simply executing the previous example after commenting the require procedure.